Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ConnectedAccountPolicy.php 1.1KB

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