2020-04-10 20:32:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use App\Providers\RouteServiceProvider;
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
|
|
class RedirectIfAuthenticated
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2022-03-11 20:19:17 +01:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param string|null $guard
|
|
|
|
*
|
2020-04-10 20:32:12 +02:00
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next, $guard = null)
|
|
|
|
{
|
|
|
|
if (Auth::guard($guard)->check()) {
|
|
|
|
return redirect(RouteServiceProvider::HOME);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|