After upgrading to 3.2 canManage stopped working
I was using this code:
and it was working.
I have updated Filament 3 from v3.1.10 to v3.2.25 a few minutes ago and now I had to commented the whole function because the error is:
Any idea why was it deprecated and what should I use instead?
14 Replies
and it won't work.
You will get "Call to undefined method App\Models\User::canManageSettings()"
How to fix this error?
the canManageSettings is just a placeholder for your own code
if you dont have permissions just return true
I am using Filament Shield
and I did run
php artisan shield:install
and set user 1 as superadmin
during the process
tthen it should be auth()->user()->hasRole("superadmin")
It worked with 3.1
hmm
But it worked before the update
hasRole has nothing to do with it
canManageSettings worked
My guess is that canManageSettings() it was removed in 3.2 or perhaps earlier
But I can't find any info about the removal so far.
There seem to be more update issues I see now:
'App\Models\User' does not implement method 'canAccessPanel'
and Undefined type 'BezhanSalleh\FilamentShield\Traits\HasPanelShield'
It seems to be related to Filament Shield probably.
@Bezhan Do you know about any issues like that with Filament Shield? The version v3.1.10 worked fine with your plugin, but after updating Filament to v3.2.25 it shows these errors.
canAccessPanel is a filament method
yes
you need to setup your User
See the
implenents FilamentUser
on the UserDO NOT TAG PEOPLE! #β
βrules
Now as per your issue... It would be cool if you could add at least the User model. Now we are blindly guessing what happened to your code
I'd recommend you to either:
1. Revert all the changes and start again
2. Look at the git diff log and see what changed exactly
If something worked on a minor version before - it should in theory work now, but it seems like you either lost something or there was an update. I would re-take the steps to configure that exact part from scratch. That way you can find the issue π
It seems that Bezhan did breaking changes in his plugin. My guess is you now don't need that in page at all and you just set up it in the plugin. But we will see what he will say.
I know him on this forum that's why I tagged him.
I am sure he is OK with that.
Rules are rules π So it doesn't matter if you are sure or not - they still apply. He was not part of this conversation, nor you went to #bezhansalleh-shield channel to post the issue. This means tagging people is not okay π
If it was his package that broke something you should check github release notes to see what really changed