Undefined method 'isAdmin'.

I have created a User.php model and have added the isAdmin() function method to the User.php, but in my PengajuanResource.php Undefined method 'isAdmin'.
12 Replies
akame
akameOP2y ago
please, help. i have no idea what the problem anyone, help
Bruno Pereira
Bruno Pereira2y ago
Have you tried to dump composer and clear caches?
akame
akameOP2y ago
Yes, I've done that and still no change
Bruno Pereira
Bruno Pereira2y ago
Hmm, that's strange Can you dd(auth()->user(),auth()->user) and show the output here please? I just want to know what type of data it is, I don't want to know the information of the vars
akame
akameOP2y ago
thanks, but where i put the (auth()->user(),auth()->user)?
Bruno Pereira
Bruno Pereira2y ago
You can put it on the blade file Don't forget the dd before the ()
Dennis Koch
Dennis Koch2y ago
It’s probably only intellisense not knowing the exact user model. Or does your code throw actual errors on runtime? Also: 1. Be patient! 2. Read #✅┊rules
Matthew
Matthew2y ago
can you pls try and do: php artisan view:clear php artisan filament:upgrade? Maybe some cache is messing up with your intellisense
akame
akameOP2y ago
i change the auth()->user()->isAdmin() to auth()->user()-role. but when I run the application an error message appears "Unable to resolve dependency [Parameter #0 [ <required> $value ]] in class App\Filament\Resources\PengajuanResource"
Dennis Koch
Dennis Koch2y ago
$value is not a valid param. It’s $state
umardi_
umardi_2y ago
I have the same problem, and as long as it works, i just let it as it is.
Henry
Henry2y ago
do you have a model for roles?

Did you find this page helpful?