mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
30 lines
600 B
PHP
30 lines
600 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class RedirectIfAuthenticated
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*/
|
|
/**
|
|
* @param Closure(Request):Response $next
|
|
* @return Response
|
|
*/
|
|
public function handle(Request $request, Closure $next, ?string $guard = null): mixed
|
|
{
|
|
if (Auth::guard($guard)->check()) {
|
|
return to_route('index');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|