|
|
@ -3,6 +3,7 @@ |
|
|
namespace App\Http\Controllers\Admin; |
|
|
namespace App\Http\Controllers\Admin; |
|
|
|
|
|
|
|
|
use App\Exceptions\CustomException; |
|
|
use App\Exceptions\CustomException; |
|
|
|
|
|
use App\Models\ParkingElectronicMap; |
|
|
use App\Services\AdminFloorService; |
|
|
use App\Services\AdminFloorService; |
|
|
use App\Services\ApiResponseService; |
|
|
use App\Services\ApiResponseService; |
|
|
use App\Services\ParkingElectronicMapService; |
|
|
use App\Services\ParkingElectronicMapService; |
|
|
@ -42,7 +43,9 @@ class ParkingElectronicMapController extends BaseController |
|
|
try { |
|
|
try { |
|
|
$building_floor = $request->get('building_floor', '1'); |
|
|
$building_floor = $request->get('building_floor', '1'); |
|
|
$data = [ |
|
|
$data = [ |
|
|
'floor_list' => AdminFloorService::getSelectList($building_floor) |
|
|
'floor_list' => AdminFloorService::getSelectList( |
|
|
|
|
|
$building_floor |
|
|
|
|
|
) |
|
|
]; |
|
|
]; |
|
|
return $this->responseService->success($data); |
|
|
return $this->responseService->success($data); |
|
|
} catch (Exception $e) { |
|
|
} catch (Exception $e) { |
|
|
@ -115,8 +118,12 @@ class ParkingElectronicMapController extends BaseController |
|
|
]; |
|
|
]; |
|
|
if ($is_save) { |
|
|
if ($is_save) { |
|
|
$rules['parking_space_id'] = 'required|numeric'; |
|
|
$rules['parking_space_id'] = 'required|numeric'; |
|
|
$messages['parking_space_id.required'] = __('validation.map.p_empty'); |
|
|
$messages['parking_space_id.required'] = __( |
|
|
$messages['parking_space_id.numeric'] = __('validation.map.p_number'); |
|
|
'validation.map.p_empty' |
|
|
|
|
|
); |
|
|
|
|
|
$messages['parking_space_id.numeric'] = __( |
|
|
|
|
|
'validation.map.p_number' |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
|
|
|
|
|
|
@ -137,7 +144,8 @@ class ParkingElectronicMapController extends BaseController |
|
|
$this->saveValidator($item, 1); |
|
|
$this->saveValidator($item, 1); |
|
|
} |
|
|
} |
|
|
$this->service->saveModel($saveData); |
|
|
$this->service->saveModel($saveData); |
|
|
return $this->responseService->success([], __('admin.save_succeeded')); |
|
|
return $this->responseService->success([], |
|
|
|
|
|
__('admin.save_succeeded')); |
|
|
} catch (CustomException|ValidationException $e) { |
|
|
} catch (CustomException|ValidationException $e) { |
|
|
throw $e; |
|
|
throw $e; |
|
|
} catch (Exception $e) { |
|
|
} catch (Exception $e) { |
|
|
@ -146,7 +154,6 @@ class ParkingElectronicMapController extends BaseController |
|
|
$m_prefix . ':' . $e->getMessage() |
|
|
$m_prefix . ':' . $e->getMessage() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function index(Request $request): JsonResponse |
|
|
public function index(Request $request): JsonResponse |
|
|
@ -165,4 +172,23 @@ class ParkingElectronicMapController extends BaseController |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function destroy(string $id) |
|
|
|
|
|
{ |
|
|
|
|
|
try { |
|
|
|
|
|
$this->validateId($id, ParkingElectronicMap::class); |
|
|
|
|
|
$this->service->deleteModel($id); |
|
|
|
|
|
return $this->responseService->success( |
|
|
|
|
|
null, |
|
|
|
|
|
__('admin.delete_succeeded') |
|
|
|
|
|
); |
|
|
|
|
|
} catch (ValidationException $e) { |
|
|
|
|
|
throw $e; |
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
|
return $this->responseService->systemError( |
|
|
|
|
|
__('admin.operation_failed') . ':' |
|
|
|
|
|
. $e->getMessage() |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|