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