本文整理汇总了PHP中App\Http\Middleware\Auth::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::logout方法的具体用法?PHP Auth::logout怎么用?PHP Auth::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Middleware\Auth
的用法示例。
在下文中一共展示了Auth::logout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->user()->is_admin) {
return redirect('/admin/dashboard');
}
if (!$request->user()->is_active) {
\Auth::logout();
return redirect('/auth/login')->withErrors(['deactivated' => 'Your account has been deactivated. Contact admin for more information.']);
}
return $next($request);
}
示例2: handle
/**
* Handles the user activation.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!\Auth::user()->active) {
flash()->overlay('You must activate your account. Check your email.', 'Whoops.');
return redirect('/');
}
if (\Auth::user()->locked_out) {
//This is for backup and restore operations, see BackupController@lockUsers
flash()->overlay("You are temporarily locked out during system maintenance. Wait a few minutes and\n try again, your account will be unlocked soon.", 'Whoops.');
\Auth::logout();
return redirect('/');
}
return $next($request);
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}
if (session_id() != \Auth::user()->last_session) {
Auth::logout();
return true;
}
return $next($request);
}
示例4: handle
public function handle($request, Closure $next)
{
$rol = $this->auth->user()->getRol();
if ($rol == "Administrador") {
return view('administrator');
} elseif ($rol == "Institución") {
return view('institution');
} elseif ($rol == "Gestor") {
return view('agent');
} else {
return view('auth.login');
}
Auth::logout();
return $next($request);
}
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if (\Auth::check()) {
$user = \Auth::user();
if ($user->isBanned()) {
\Auth::logout();
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
flash()->error('Ban');
return redirect('/');
}
}
}
return $response;
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!LibraryFactory::getInstance('Permission')->hasPageAccess(request()->getRequestUri())) {
//Check if user group is deleted and no feature at all
// Log this user out or else it will cause limbo
$canAccess = false;
$userRoles = LibraryFactory::getInstance('Role')->getRoles(auth()->user()->id);
if ($userRoles->isEmpty()) {
// logout user
\Auth::logout();
session()->flush();
return redirect('/')->with('error', 'Unauthorized Access.');
}
return back()->with('error', 'Unauthorized Access.');
}
return $next($request);
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (isAdmin() || isCustomer()) {
\Auth::logout();
}
// Panelist HTTP Basic Auth
if (isset($_SERVER['PHP_AUTH_USER'])) {
$email = $_SERVER['PHP_AUTH_USER'];
$count = User::whereEmail($email)->has('panelist_profile')->count();
if ($count == 1) {
return \Auth::basic('email') ?: $next($request);
} else {
return \Auth::basic('email');
}
} else {
return \Auth::basic('email');
}
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
$user = \Auth::user();
if ($user != null && $user->enabled == 0) {
\Auth::logout();
$error = new \Illuminate\Support\MessageBag();
$error->add('Disalbed', 'User is not enabled.');
return redirect('auth/login')->with(['errors' => $error]);
} else {
if ($user != null && isAdmin()) {
return redirect('admin/dashboard');
} else {
if ($user != null && isCustomer()) {
return redirect('members/dashboard');
}
}
}
return $response;
}
示例9: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('/');
}
}
if (\Auth::user()->archive == 1) {
$email = \Auth::user()->email;
\Auth::logout();
return view('auth.suspended_user', compact('email'));
}
if (!\Auth::user()->isActive()) {
$email = \Auth::user()->email;
$date = \Auth::user()->created_at->format('Y-m-d');
\Auth::logout();
return view('auth.guest_activate')->with('email', $email)->with('date', $date);
}
return $next($request);
}