canDo('evnt.event_invitation.view') && $user->isAdmin()) { return true; } return $event_invitation->user_id == user_id() && $event_invitation->user_type == user_type(); } /** * Determine if the given user can create a event_invitation. * * @param UserPolicy $user * @param EventInvitation $event_invitation * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('evnt.event_invitation.create'); } /** * Determine if the given user can update the given event_invitation. * * @param UserPolicy $user * @param EventInvitation $event_invitation * * @return bool */ public function update(UserPolicy $user, EventInvitation $event_invitation) { if ($user->canDo('evnt.event_invitation.edit') && $user->isAdmin()) { return true; } return $event_invitation->user_id == user_id() && $event_invitation->user_type == user_type(); } /** * Determine if the given user can delete the given event_invitation. * * @param UserPolicy $user * @param EventInvitation $event_invitation * * @return bool */ public function destroy(UserPolicy $user, EventInvitation $event_invitation) { return $event_invitation->user_id == user_id() && $event_invitation->user_type == user_type(); } /** * Determine if the given user can verify the given event_invitation. * * @param UserPolicy $user * @param EventInvitation $event_invitation * * @return bool */ public function verify(UserPolicy $user, EventInvitation $event_invitation) { if ($user->canDo('evnt.event_invitation.verify')) { return true; } return false; } /** * Determine if the given user can approve the given event_invitation. * * @param UserPolicy $user * @param EventInvitation $event_invitation * * @return bool */ public function approve(UserPolicy $user, EventInvitation $event_invitation) { if ($user->canDo('evnt.event_invitation.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; } } }