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