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