選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ConnectedAccountPolicy.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Policies;
  3. use App\Models\ConnectedAccount;
  4. use App\Models\User;
  5. use Illuminate\Auth\Access\HandlesAuthorization;
  6. class ConnectedAccountPolicy
  7. {
  8. use HandlesAuthorization;
  9. /**
  10. * Determine whether the user can view any models.
  11. */
  12. public function viewAny(User $user): bool
  13. {
  14. return true;
  15. }
  16. /**
  17. * Determine whether the user can view the model.
  18. */
  19. public function view(User $user, ConnectedAccount $connectedAccount): bool
  20. {
  21. return $user->ownsConnectedAccount($connectedAccount);
  22. }
  23. /**
  24. * Determine whether the user can create models.
  25. */
  26. public function create(User $user): bool
  27. {
  28. return true;
  29. }
  30. /**
  31. * Determine whether the user can update the model.
  32. */
  33. public function update(User $user, ConnectedAccount $connectedAccount): bool
  34. {
  35. return $user->ownsConnectedAccount($connectedAccount);
  36. }
  37. /**
  38. * Determine whether the user can delete the model.
  39. */
  40. public function delete(User $user, ConnectedAccount $connectedAccount): bool
  41. {
  42. return $user->ownsConnectedAccount($connectedAccount);
  43. }
  44. }