%PDF- %PDF-
Direktori : /var/www/html/camillo/camillo-api-master/app/Policies/ |
Current File : /var/www/html/camillo/camillo-api-master/app/Policies/ArrivalExceptionPolicy.php |
<?php namespace App\Policies; use App\Enums\UsertypeEnum; use App\Models\ArrivalException; use App\User; use Illuminate\Auth\Access\HandlesAuthorization; class ArrivalExceptionPolicy { use HandlesAuthorization; /** * Completely hides the classroom. * * @param \App\User $user * @return mixed */ public function viewAny(User $user) { $allowed = [ UsertypeEnum::ADMIN, UsertypeEnum::PRINCIPAL ]; return in_array($user->usertype->role, $allowed); } /** * Determine whether the user can view the event. * * @param \App\User $user * @param ArrivalException $arrivalException * @return mixed */ public function view(User $user, ArrivalException $arrivalException) { $allowed = [ UsertypeEnum::ADMIN, UsertypeEnum::PRINCIPAL ]; return in_array($user->usertype->role, $allowed); } /** * Determine whether the user can create events. * * @param \App\User $user * @return mixed */ public function create(User $user) { return $user->usertype->role === UsertypeEnum::ADMIN; } /** * Determine whether the user can update the event. * * @param \App\User $user * @param ArrivalException $arrivalException * @return mixed */ public function update(User $user, ArrivalException $arrivalException) { return $user->usertype->role === UsertypeEnum::ADMIN; } /** * Determine whether the user can delete the event. * * @param \App\User $user * @param ArrivalException $arrivalException * @return mixed */ public function delete(User $user, ArrivalException $arrivalException) { return $user->usertype->role === UsertypeEnum::ADMIN; } /** * Determine whether the user can restore the event. * * @param \App\User $user * @param ArrivalException $arrivalException * @return mixed */ public function restore(User $user, ArrivalException $arrivalException) { return $user->usertype->role === UsertypeEnum::ADMIN; } /** * Determine whether the user can permanently delete the event. * * @param \App\User $user * @param ArrivalException $arrivalException * @return mixed */ public function forceDelete(User $user, ArrivalException $arrivalException) { return $user->usertype->role === UsertypeEnum::ADMIN; } }