Problem with viewAny in a FIlament Resource
Hello, i have a problem when i call the viewAny() function in a resource
I get null when i login to the Filament Pane as a user is there a solution to this or another way to achieve that?
6 Replies
It can't be null if you are logged in... Are you sure you are logged in, if you return true does the resource render as logged in?
Actually it could be null on evaluation, but the actually check wouldn't be null so:
Well i am sure the user exists in my table and without this function i can loggin successfully.
For example lets say i have in my table a column in the users table that is level and i do
i receive this error:
when i click the Log in and yes if i return true i can login successfully
when i click the Log in and yes if i return true i can login successfully
auth()->user()?->level > 30
Does it then work as expected?
user maybe null on initialisation but then on running the check it has a user object
Well it does not work because as i told you a receive that the property "level" is null and the whole auth()->user() is null
Correct, But does the test work correctly. i.e. if the user has a level > 30 is it true?
Inverse it if need be.
Do you understand the evualtion process? Vs the calling function process?
Given filament needs to validate all resources/find them it evaluates them/thecode.
Then it boots the applicaiton with the user.
yes if the user has a level more than 30 the it should be able to see the specific resource
i am sorry can you explain me what you mean by the process you wrote ?