auth()->user() everytime null
Hello,
i'm new at filament. I'm not sure but i read multiple times that i can't use
My Question is: Is it really true, that i cannot use
And inside his code
If i use no custom guards, just the regular
Here my Code.
config/auth.php
i'm new at filament. I'm not sure but i read multiple times that i can't use
auth()->user() function because it's every time null, i have to use instead Filament::auth()->user() . I created a custom admin guard with the Model SystemUser. The login works fine with them. My Question is: Is it really true, that i cannot use
auth()->user(), when i use a custom guard? Because i installed an Plugin https://filamentphp.com/plugins/shuvroroy-spatie-laravel-backup. And inside his code
https://github.com/shuvroroy/filament-spatie-laravel-backup/blob/main/src/Components/BackupDestinationListRecords.php on Line 78 he used auth()->user()->can('delete-backup'). But this throws an error, because auth()->user() is still null.If i use no custom guards, just the regular
User Model, everything works fine. The Plugin works without problems and when i call auth()->user() it's no more null. Here my Code.
config/auth.php