pelican-panel-banquise/app/Http/Middleware/RedirectIfAuthenticated.php
Charles 1900c04b71
Filament v4 🎉 (#1651)
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: Lance Pioch <git@lance.sh>
2025-09-08 13:12:33 -04:00

22 lines
465 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
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);
}
}