public function ban($id)
{
try {
$user = $this->sentry->getUserProvider()->findById($id);
// Find the user using the user id
$throttle = $this->sentry->findThrottlerByUserId($user->id);
// Ban the user
$throttle->ban();
// Clear the persist code
$user->persist_code = null;
$user->save();
// Fire the 'banned user' event
$this->dispatcher->fire('sentinel.user.banned', ['user' => $user]);
return new SuccessResponse(trans('Sentinel::users.banned'), ['userId' => $id]);
} catch (UserNotFoundException $e) {
$message = trans('Sentinel::sessions.invalid');
return new ExceptionResponse($message);
}
}