AgonK
AgonK
FFilament
Created by AgonK on 9/15/2024 in #❓┊help
auth()->user cannot be read after login in middleware ?
I have created a middleware and placed in app.php file on laravel side. I try to read value in every request but the problem is that I can't read any property from auth() after login. Yes, on the first request the auth() does not exist, but after login it should be readable. Moreover, I have placed some data in the Session::put('some_data', $data), even these data do not exist(I checked with debug). Thank you anyway!
7 replies
FFilament
Created by AgonK on 9/11/2024 in #❓┊help
Customizing filament login behavior
I'm having a problem customizing the login behavior in filament I have a SaaS API project with multiple databases. On the login request I get the credentials and find the user database and reconnect to the respective database and on the next request I get the database from token and reconnect again and everything works fine in my API branch. Now, I am using filament for admin panel, and for using this structure I have created new login class and extend \Filament\Pages\Auth\Login and modify authenticate()method What I did here is, get the credential, find the appropriate database for this client and pass the default database to the corresponding database and add a new field to the session database name data. On the other hand, I create a middleware for the next request when the session is isset and the database name exists, reconnect this database and continue. This middleware is in my AdminPannelProvider in authMiddleware method. But this structure does not work as I expected. What I'm missing here. Do you have any ideas?
2 replies