role->permissions->contains(Permission::firstWhere('name','=','cabels_viewAny')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can view any models. * * @return Response */ public function viewAny_deleted(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_viewAny_deleted')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can view the model. * * @return Response */ public function view(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_view')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can create models. * * @return Response */ public function create(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_create')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can update the model. * * @return Response */ public function edit(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_edit')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can delete the model. * * @return Response */ public function delete(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_delete')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can delete the model. * * @return Response */ public function delete_force(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_delete_force')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can restore the model. * * @return Response|bool */ public function restore() { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_restore')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can add to the pool. * * @return Response|bool */ public function amount_add() { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_amount_add')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can remove from the pool. * * @return Response|bool */ public function amount_remove() { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','cabels_amount_remove')) ? Response::allow() : Response::deny('you are not the chosen one'); } }