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