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
please, help. i have no idea what the problem
anyone, help
Have you tried to dump composer and clear caches?
Yes, I've done that and still no change
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
thanks, but where i put the (auth()->user(),auth()->user)?
You can put it on the blade file
Don't forget the dd before the ()
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
can you pls try and do:
php artisan view:clear
php artisan filament:upgrade?
Maybe some cache is messing up with your intellisense
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"
$value
is not a valid param. It’s $state
I have the same problem, and as long as it works, i just let it as it is.
do you have a model for roles?