領収証発行サービス
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.

53 lines
1.1KB

  1. <?php
  2. namespace App\Http\Controllers\Web\Contract;
  3. use App\Codes\UserRole;
  4. use App\Http\Controllers\Web\IParam;
  5. use App\Http\Controllers\Web\WebController;
  6. use App\Repositories\ContractRepository;
  7. use Illuminate\Http\JsonResponse;
  8. use Illuminate\Http\Request;
  9. class ContractsController extends WebController
  10. {
  11. public function name(): string
  12. {
  13. return "契約一覧取得";
  14. }
  15. public function description(): string
  16. {
  17. return "契約一覧を取得する";
  18. }
  19. public function __construct(
  20. protected ContractsParam $param,
  21. private ContractRepository $repository
  22. ) {
  23. parent::__construct();
  24. $this->roleAllow(UserRole::SUPER_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. $condition = [
  34. ...$param->toArray(),
  35. ];
  36. $list = $this->repository->get($condition);
  37. return $this->successResponse([
  38. 'records' => $list
  39. ]);
  40. }
  41. }