|
|
|
@ -92,9 +92,11 @@ class ParkingLicensePlateController extends BaseController |
|
|
|
null, |
|
|
|
__('admin.save_succeeded') |
|
|
|
); |
|
|
|
} catch (ValidationException|CustomException $e) { |
|
|
|
} catch (ValidationException $e) { |
|
|
|
throw $e; |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (CustomException $e) { |
|
|
|
return $this->responseService->businessError($e->getMessage()); |
|
|
|
} catch (Exception $e) { |
|
|
|
return $this->responseService->systemError( |
|
|
|
__('exception.license_plate.create_failed') . ':' |
|
|
|
. $e->getMessage() |
|
|
|
@ -107,6 +109,7 @@ class ParkingLicensePlateController extends BaseController |
|
|
|
* @param int $id |
|
|
|
* @return void |
|
|
|
* @throws ValidationException |
|
|
|
* @throws CustomException |
|
|
|
*/ |
|
|
|
protected function saveValidator(array $data, int $id = 0): void |
|
|
|
{ |
|
|
|
@ -128,6 +131,12 @@ class ParkingLicensePlateController extends BaseController |
|
|
|
} |
|
|
|
$validator = Validator::make($data, $rules, $messages); |
|
|
|
|
|
|
|
$error_str = $this->LicensePlateService->validateLicensePlate( |
|
|
|
$data['number'] |
|
|
|
); |
|
|
|
if ($error_str) { |
|
|
|
throw new CustomException($error_str); |
|
|
|
} |
|
|
|
if ($validator->fails()) { |
|
|
|
throw new ValidationException($validator); |
|
|
|
} |
|
|
|
@ -149,8 +158,10 @@ class ParkingLicensePlateController extends BaseController |
|
|
|
null, |
|
|
|
__('admin.update_succeeded') |
|
|
|
); |
|
|
|
} catch (ValidationException|CustomException $e) { |
|
|
|
} catch (ValidationException $e) { |
|
|
|
throw $e; |
|
|
|
} catch (CustomException $e) { |
|
|
|
return $this->responseService->businessError($e->getMessage()); |
|
|
|
} catch (Exception $e) { |
|
|
|
return $this->responseService->systemError( |
|
|
|
__('exception.license_plate.update_failed') . ':' |
|
|
|
|