RedirectIfAuthenticated.php (523B)
1 <?php 2 3 namespace App\Http\Middleware; 4 5 use Closure; 6 use Illuminate\Support\Facades\Auth; 7 8 class RedirectIfAuthenticated 9 { 10 /** 11 * Handle an incoming request. 12 * 13 * @param \Illuminate\Http\Request $request 14 * @param \Closure $next 15 * @param string|null $guard 16 * @return mixed 17 */ 18 public function handle($request, Closure $next, $guard = null) 19 { 20 if (Auth::guard($guard)->check()) { 21 return redirect('/home'); 22 } 23 24 return $next($request); 25 } 26 }