canDo('activities.attendee.view') && $user->isAdmin()) { return true; } return $attendee->user_id == user_id() && $attendee->user_type == user_type(); } /** * Determine if the given user can create a attendee. * * @param UserPolicy $user * @param Attendee $attendee * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('activities.attendee.create'); } /** * Determine if the given user can update the given attendee. * * @param UserPolicy $user * @param Attendee $attendee * * @return bool */ public function update(UserPolicy $user, Attendee $attendee) { if ($user->canDo('activities.attendee.edit') && $user->isAdmin()) { return true; } return $attendee->user_id == user_id() && $attendee->user_type == user_type(); } /** * Determine if the given user can delete the given attendee. * * @param UserPolicy $user * @param Attendee $attendee * * @return bool */ public function destroy(UserPolicy $user, Attendee $attendee) { return $attendee->user_id == user_id() && $attendee->user_type == user_type(); } /** * Determine if the given user can verify the given attendee. * * @param UserPolicy $user * @param Attendee $attendee * * @return bool */ public function verify(UserPolicy $user, Attendee $attendee) { if ($user->canDo('activities.attendee.verify')) { return true; } return false; } /** * Determine if the given user can approve the given attendee. * * @param UserPolicy $user * @param Attendee $attendee * * @return bool */ public function approve(UserPolicy $user, Attendee $attendee) { if ($user->canDo('activities.attendee.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $user [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($user, $ability) { if ($user->isSuperuser()) { return true; } } }