Services\UserManager::deactivateUser PHP Method

deactivateUser() public method

Deactivate a user
public deactivateUser ( $id ) : mixed | void
$id User ID
return mixed | void
    public function deactivateUser($id)
    {
        if (current_user() && $id == current_user()->id) {
            throw new Exception('You can not deactivate yourself.');
        }
        try {
            // Find the user using the user id
            $throttle = Sentry::findThrottlerByUserId($id);
            // Ban the user
            $throttle->ban();
        } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
            throw new Exception('User was not found.');
        }
    }