Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Http/Middleware/RedirectIfAuthenticated.php
10279 views
1
<?php
2
3
namespace Pterodactyl\Http\Middleware;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Auth\AuthManager;
7
8
class RedirectIfAuthenticated
9
{
10
/**
11
* RedirectIfAuthenticated constructor.
12
*/
13
public function __construct(private AuthManager $authManager)
14
{
15
}
16
17
/**
18
* Handle an incoming request.
19
*/
20
public function handle(Request $request, \Closure $next, ?string $guard = null): mixed
21
{
22
if ($this->authManager->guard($guard)->check()) {
23
return redirect()->route('index');
24
}
25
26
return $next($request);
27
}
28
}
29
30