2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
2016-09-03 22:09:00 +01:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2015-12-06 18:58:49 +00:00
|
|
|
|
|
|
|
class RedirectIfAuthenticated
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2017-08-22 04:10:48 +01:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
* @param string|null $guard
|
2015-12-06 18:58:49 +00:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2016-09-03 22:09:00 +01:00
|
|
|
public function handle($request, Closure $next, $guard = null)
|
2015-12-06 18:58:49 +00:00
|
|
|
{
|
2016-09-03 22:09:00 +01:00
|
|
|
if (Auth::guard($guard)->check()) {
|
2017-04-01 22:59:43 +01:00
|
|
|
return redirect(route('index'));
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|