PteroTheme/app/Http/Middleware/RedirectIfAuthenticated.php

29 lines
584 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http\Middleware;
2017-10-29 17:37:25 +00:00
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
class RedirectIfAuthenticated
{
2017-10-29 17:37:25 +00:00
/**
* RedirectIfAuthenticated constructor.
*/
public function __construct(private AuthManager $authManager)
2017-10-29 17:37:25 +00:00
{
}
/**
* Handle an incoming request.
*/
2023-02-23 19:30:16 +00:00
public function handle(Request $request, \Closure $next, string $guard = null): mixed
{
2017-10-29 17:37:25 +00:00
if ($this->authManager->guard($guard)->check()) {
2017-11-03 23:16:49 +00:00
return redirect()->route('index');
}
return $next($request);
}
}