tethys/app/Http/Middleware/RedirectIfAuthenticated.php

26 lines
492 B
PHP
Raw Normal View History

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()) {
2019-02-12 11:21:35 +00:00
return redirect('/home');
2018-08-06 12:30:51 +00:00
}
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
}