Middleware to check if user has the profile completed

I'm attempting to direct a user to a particular page to complete their registration. The concept is that if they attempt to navigate to any page or resource, they'll be redirected to a custom page I've created where they can complete their registration. I initially attempted to create a Middleware for this purpose, but encountered an issue where auth()->user() is not available at that moment. Therefore, I'm seeking an alternative method to consistently redirect the user to that page until certain fields in the user's table are filled. Do you have any suggestions on how I can achieve this?
6 Replies
LeandroFerreira
LeandroFerreira2mo ago
Where did you put this middleware?
JoseBravo
JoseBravo2mo ago
I registered it in the array $middleware, at Kernel.php
LeandroFerreira
LeandroFerreira2mo ago
you should register in your panel provider
$panel
->middleware([...])
$panel
->middleware([...])
JoseBravo
JoseBravo2mo ago
I'm using the v2 How can I register the middleware in the version 2?
LeandroFerreira
LeandroFerreira2mo ago
GitHub
filament/packages/admin/config/filament.php at 2.x · filamentphp/fi...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
JoseBravo
JoseBravo2mo ago
Awesome! thanks Leandro