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