2015-07-08 03:34:58 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
2016-01-03 23:55:13 -05:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2015-07-08 03:34:58 -04:00
|
|
|
|
|
|
|
class RedirectIfAuthenticated
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
2016-01-03 23:55:13 -05:00
|
|
|
* @param string|null $guard
|
2015-07-08 03:34:58 -04:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2016-01-03 23:55:13 -05:00
|
|
|
public function handle($request, Closure $next, $guard = null)
|
2015-07-08 03:34:58 -04:00
|
|
|
{
|
2016-01-03 23:55:13 -05:00
|
|
|
if (Auth::guard($guard)->check()) {
|
2016-01-26 23:20:08 -05:00
|
|
|
return redirect('/dashboard');
|
2015-07-08 03:34:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|