phpldapadmin/app/Http/Middleware/RedirectIfAuthenticated.php

28 lines
582 B
PHP
Raw Normal View History

2019-05-14 07:52:49 +00:00
<?php
namespace App\Http\Middleware;
2020-08-23 01:37:08 +00:00
use App\Providers\RouteServiceProvider;
2019-05-14 07:52:49 +00:00
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
2020-08-23 01:37:08 +00:00
return redirect(RouteServiceProvider::HOME);
2019-05-14 07:52:49 +00:00
}
return $next($request);
}
}