|
- <?php
-
- namespace App\Http\Controllers\Web\Custom\HelloTechno;
-
- use App\Codes\UserRole;
- use App\Exceptions\AppCommonException;
- use App\Http\Controllers\Web\IParam;
- use App\Util\Custom\HelloTechno\API;
- use Illuminate\Http\JsonResponse;
- use Illuminate\Http\Request;
- use Illuminate\Support\Arr;
-
- class ParkingByCodeController extends HelloTechnoController
- {
- public function name(): string
- {
- return "[HelloTechno専用]駐車場情報取得(駐車場管理コード指定)";
- }
-
- public function description(): string
- {
- return "[HelloTechno専用]駐車場情報を取得する(駐車場管理コード指定)";
- }
-
- public function __construct(
- protected ParkingByCodeParam $param,
- ) {
- parent::__construct();
- $this->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);
- }
- }
|