領収証発行サービス
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

50 行
1.2KB

  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(null, $param->parkingManagementCode));
  34. if ($parking === null) {
  35. throw new AppCommonException("駐車場情報取得不正");
  36. }
  37. return $this->successResponse($parking);
  38. }
  39. }