Middleware auth + custom in Filament Blade

can i ask something differnt? i have some page
/building/id
/my/transaction
/my/booking

btw, for now, i will stay on /admin/login as login page route

i want to make a middleware for check does user have change their default password? if not they will redirect ot reset-password page, if user already change their default password, they can acccess di page

class CheckFirstLogin
{
    public function handle(Request $request, Closure $next)
    {
        $user = Auth::user();

        if ($user && $user->is_first == 1) {
            Password::sendResetLink(['email' => $user->email]);
            return redirect('/reset-password-send')->with('status', 'Silakan cek email Anda untuk reset password.');
        }

        return $next($request);
    }
}



how do i implement this middleware in filament, i also want to check if user already login or not, if they didnt login yet, the will redirected to login page
Was this page helpful?