diff --git a/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeController.php b/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeController.php new file mode 100644 index 0000000..7d18788 --- /dev/null +++ b/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeController.php @@ -0,0 +1,49 @@ +roleAllow(UserRole::NORMAL_ADMIN); + } + + protected function getParam(): IParam + { + return $this->param; + } + + protected function run(Request $request): JsonResponse + { + $param = $this->param; + + $parking = Arr::first(API::getParkings(null, $param->parkingManagementCode)); + + if ($parking === null) { + throw new AppCommonException("駐車場情報取得不正"); + } + + return $this->successResponse($parking); + } +} diff --git a/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeParam.php b/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeParam.php new file mode 100644 index 0000000..a3e6e79 --- /dev/null +++ b/app/Http/Controllers/Web/Custom/HelloTechno/ParkingByCodeParam.php @@ -0,0 +1,18 @@ + $this->str() + ]; + } +} diff --git a/app/Util/Custom/HelloTechno/API.php b/app/Util/Custom/HelloTechno/API.php index fe90cd4..92d6f2c 100644 --- a/app/Util/Custom/HelloTechno/API.php +++ b/app/Util/Custom/HelloTechno/API.php @@ -35,10 +35,12 @@ class API return static::get(static::getCustomersUrl(), $query); } - public static function getParkings(string $customerCode, ?string $parkingManagementCode = null) + public static function getParkings(?string $customerCode, ?string $parkingManagementCode = null) { - $query['customer_code'] = $customerCode; + if ($customerCode) { + $query['customer_code'] = $customerCode; + } if ($parkingManagementCode) { $query['parking_management_code'] = $parkingManagementCode; } diff --git a/routes/api.php b/routes/api.php index edd154f..6e0d653 100644 --- a/routes/api.php +++ b/routes/api.php @@ -43,6 +43,7 @@ RouteHelper::post('/user/change-password', App\Http\Controllers\Web\LoginUser\Ch // Custom for HelloTechno RouteHelper::get('/custom/hello-techno/customers', App\Http\Controllers\Web\Custom\HelloTechno\CustomersController::class); RouteHelper::get('/custom/hello-techno/parkings', App\Http\Controllers\Web\Custom\HelloTechno\ParkingsController::class); +RouteHelper::get('/custom/hello-techno/parking/by-code', App\Http\Controllers\Web\Custom\HelloTechno\ParkingByCodeController::class); RouteHelper::get('/custom/hello-techno/adjust-data', App\Http\Controllers\Web\Custom\HelloTechno\AdjustDataController::class); // RouteHelper::get('/custom/hello-techno/adjust-data', App\Http\Controllers\Web\Custom\HelloTechno\CustomersController::class); RouteHelper::get('/custom/hello-techno/receipt-issuing-orders', App\Http\Controllers\Web\Custom\HelloTechno\ReceiptIssuingOrdersController::class);