3 namespace App\Policies;
6 use Illuminate\Auth\Access\HandlesAuthorization;
10 use HandlesAuthorization;
13 * Determine whether the user can view any models.
15 * @param \App\Models\User $user
16 * @return \Illuminate\Auth\Access\Response|bool
18 public function viewAny(?User $user)
24 * Determine whether the user can view the model.
26 * @param \App\Models\User $user
27 * @param \App\Models\User $model
28 * @return \Illuminate\Auth\Access\Response|bool
30 public function view(?User $user, User $model)
36 * Determine whether the user can create models.
38 * @param \App\Models\User $user
39 * @return \Illuminate\Auth\Access\Response|bool
41 public function create(User $user)
47 * Determine whether the user can update the model.
49 * @param \App\Models\User $user
50 * @param \App\Models\User $model
51 * @return \Illuminate\Auth\Access\Response|bool
53 public function update(User $user, User $model)
55 return $user->id === $model->id;
59 * Determine whether the user can delete the model.
61 * @param \App\Models\User $user
62 * @param \App\Models\User $model
63 * @return \Illuminate\Auth\Access\Response|bool
65 public function delete(User $user, User $model)
71 * Determine whether the user can restore the model.
73 * @param \App\Models\User $user
74 * @param \App\Models\User $model
75 * @return \Illuminate\Auth\Access\Response|bool
77 public function restore(User $user, User $model)
83 * Determine whether the user can permanently delete the model.
85 * @param \App\Models\User $user
86 * @param \App\Models\User $model
87 * @return \Illuminate\Auth\Access\Response|bool
89 public function forceDelete(User $user, User $model)
95 * Determine whether the user change the stream link of the model.
97 * @param \App\Models\User $user
98 * @param \App\Models\User $model
99 * @return \Illuminate\Auth\Access\Response|bool
101 public function setNickname(User $user, User $model)
103 return $user->role == 'admin' || $user->id == $model->id;
107 * Determine whether the user change the stream link of the model.
109 * @param \App\Models\User $user
110 * @param \App\Models\User $model
111 * @return \Illuminate\Auth\Access\Response|bool
113 public function setStreamLink(User $user, User $model)
115 return $user->role == 'admin' || $user->id == $model->id;