ProfilePolicy.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace App\Policies;
  3. use App\Models\Profile;
  4. use App\Models\User;
  5. use Illuminate\Auth\Access\HandlesAuthorization;
  6. class ProfilePolicy
  7. {
  8. use HandlesAuthorization;
  9. /**
  10. * Determine whether the user can view any models.
  11. *
  12. * @param \App\Models\User $user
  13. * @return mixed
  14. */
  15. public function viewAny(User $user)
  16. {
  17. //
  18. }
  19. /**
  20. * Determine whether the user can view the model.
  21. *
  22. * @param \App\Models\User $user
  23. * @param \App\Models\Profile $profile
  24. * @return mixed
  25. */
  26. public function view(User $user, Profile $profile)
  27. {
  28. //
  29. }
  30. /**
  31. * Determine whether the user can create models.
  32. *
  33. * @param \App\Models\User $user
  34. * @return mixed
  35. */
  36. public function create(User $user)
  37. {
  38. //
  39. }
  40. /**
  41. * Determine whether the user can update the model.
  42. *
  43. * @param \App\Models\User $user
  44. * @param \App\Models\Profile $profile
  45. * @return mixed
  46. */
  47. public function update(User $user, Profile $profile)
  48. {
  49. return $user->id == $profile->user_id;
  50. }
  51. /**
  52. * Determine whether the user can delete the model.
  53. *
  54. * @param \App\Models\User $user
  55. * @param \App\Models\Profile $profile
  56. * @return mixed
  57. */
  58. public function delete(User $user, Profile $profile)
  59. {
  60. //
  61. }
  62. /**
  63. * Determine whether the user can restore the model.
  64. *
  65. * @param \App\Models\User $user
  66. * @param \App\Models\Profile $profile
  67. * @return mixed
  68. */
  69. public function restore(User $user, Profile $profile)
  70. {
  71. //
  72. }
  73. /**
  74. * Determine whether the user can permanently delete the model.
  75. *
  76. * @param \App\Models\User $user
  77. * @param \App\Models\Profile $profile
  78. * @return mixed
  79. */
  80. public function forceDelete(User $user, Profile $profile)
  81. {
  82. //
  83. }
  84. }