領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3KB

  1. <?php
  2. namespace App\Http\Controllers\Web\Custom\HelloTechno;
  3. use App\Codes\UserRole;
  4. use App\Exceptions\AppCommonException;
  5. use App\Http\Controllers\Web\IParam;
  6. use App\Util\Custom\HelloTechno\API;
  7. use Illuminate\Http\JsonResponse;
  8. use Illuminate\Http\Request;
  9. use Illuminate\Support\Arr;
  10. class ParkingByCodeController extends HelloTechnoController
  11. {
  12. public function name(): string
  13. {
  14. return "[HelloTechno専用]駐車場情報取得(駐車場管理コード指定)";
  15. }
  16. public function description(): string
  17. {
  18. return "[HelloTechno専用]駐車場情報を取得する(駐車場管理コード指定)";
  19. }
  20. public function __construct(
  21. protected ParkingByCodeParam $param,
  22. ) {
  23. parent::__construct();
  24. $this->roleAllow(UserRole::NORMAL_ADMIN);
  25. }
  26. protected function getParam(): IParam
  27. {
  28. return $this->param;
  29. }
  30. protected function run(Request $request): JsonResponse
  31. {
  32. $param = $this->param;
  33. $parking = Arr::first(API::getParkings([
  34. API::CONDITION_PARKING_MANAGEMENT_CODDE => $param->parkingManagementCode
  35. ]));
  36. if ($parking === null) {
  37. throw new AppCommonException("駐車場情報取得不正");
  38. }
  39. return $this->successResponse($parking);
  40. }
  41. }