F
Filament16mo ago
akame

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
akameOP16mo ago
please, help. i have no idea what the problem anyone, help
Bruno Pereira
Bruno Pereira16mo ago
Have you tried to dump composer and clear caches?
akame
akameOP16mo ago
Yes, I've done that and still no change
Bruno Pereira
Bruno Pereira16mo 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
akameOP16mo ago
thanks, but where i put the (auth()->user(),auth()->user)?
Bruno Pereira
Bruno Pereira16mo ago
You can put it on the blade file Don't forget the dd before the ()
Dennis Koch
Dennis Koch16mo 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
Matthew16mo 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
akameOP16mo 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 Koch16mo ago
$value is not a valid param. It’s $state
umardi_
umardi_16mo ago
I have the same problem, and as long as it works, i just let it as it is.
Henry
Henry16mo ago
do you have a model for roles?
Want results from more Discord servers?
Add your server