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

  1. <?php
  2. namespace App\Logic\User;
  3. use App\Codes\UserRole;
  4. use App\Models\Contract;
  5. use App\Models\User;
  6. use LogicException;
  7. class AdminUserManager extends UserManager
  8. {
  9. /**
  10. * @override
  11. */
  12. public function initForCreateAdmin(): static
  13. {
  14. $this->setUser(null);
  15. $this->initialized = true;
  16. return $this;
  17. }
  18. /**
  19. * @override
  20. */
  21. public function initForModifyAdmin(string|User $userId): static
  22. {
  23. $this->setUser($userId);
  24. $this->initialized = true;
  25. return $this;
  26. }
  27. /**
  28. * @override
  29. */
  30. public function initForCreate(string|Contract $contractId): static
  31. {
  32. throw new LogicException("不許可な関数アクセス");
  33. }
  34. /**
  35. * @override
  36. */
  37. public function initForModify(string|Contract $contractId, string|User $userId): static
  38. {
  39. throw new LogicException("不許可な関数アクセス");
  40. }
  41. protected function role(): UserRole
  42. {
  43. return UserRole::SUPER_ADMIN;
  44. }
  45. }