2018-08-06 12:30:51 +00:00
|
|
|
<?php
|
|
|
|
namespace App\Http\Middleware;
|
2015-07-19 06:49:24 +00:00
|
|
|
|
|
|
|
use Closure;
|
2018-08-06 12:30:51 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2015-07-19 06:49:24 +00:00
|
|
|
|
2018-08-06 12:30:51 +00:00
|
|
|
class RedirectIfAuthenticated
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next, $guard = null)
|
|
|
|
{
|
|
|
|
if (Auth::guard($guard)->check()) {
|
|
|
|
return redirect('/');
|
|
|
|
}
|
2015-07-19 06:49:24 +00:00
|
|
|
|
2018-08-06 12:30:51 +00:00
|
|
|
return $next($request);
|
|
|
|
}
|
2015-07-19 06:49:24 +00:00
|
|
|
}
|