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