mirror of
https://github.com/pelican-dev/panel.git
synced 2026-02-25 11:20:56 +03:00
22 lines
465 B
PHP
22 lines
465 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Auth\AuthManager;
|
|
use Illuminate\Http\Request;
|
|
|
|
readonly class RedirectIfAuthenticated
|
|
{
|
|
public function __construct(private AuthManager $authManager) {}
|
|
|
|
public function handle(Request $request, Closure $next, ?string $guard = null): mixed
|
|
{
|
|
if ($this->authManager->guard($guard)->check()) {
|
|
return redirect('/');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|