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