-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call to undefined method Spatie\Permission\Models\Permission::translationEnabled() #306
Comments
Hello there! Thanks for opening your first issue on this repo! Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that. Backpack communication mediums:
Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch. Thank you! -- |
Can confirm this bug PHP 8.1.8 |
The permissions and roles worked perfectly but in some update they stopped working. PHP 8.1.2 |
I try to troubleshoot... The culprit is the backpack/crud v5.1.3 ✔️ - Upgrading spatie/laravel-permission (5.5.4 => 5.5.5) After
Upgrade to the latest 5.1.4 doesn't help. temporary downgrade to 5.1.2
Commented out |
Hey @kiddtang @CamusMX7 @NARTONIC and @kasperbjerby I am trying to work out this issue .. The problem is that the model you guys are using does not use the CrudTrait. Let me talk with @tabacitu to try to figure out the best way to solve this, Thanks for the report and sorry for the bad experience. Cheers |
Wow such a good reply thank you @kiddtang ! Quick fix@pxpm what if we also check that -if ($model->translationEnabled()) {
+if (method_exists($model, 'translationEnabled') && $model->translationEnabled()) { Root cause analysisThe problem is interesting though. Like Pedro said... we probably should even get to this point. Why does this even try to create/update on the
|
Wait wait wait! I think I understand now! 🤯 This error appears when you:
The problem is in CRUD - that it now requires all related models to have CrudTrait - which is not ok ❌ In this case... I think the quick-fix I suggested above will also be a good long-term fix. |
@tabacitu I didn't get so deep on why the model is I will submit a PR with with your suggestion then. Cheers |
Just FYI. I have done many customizations, so I extend the in my
Also,
Also,
So, thx @pxpm @tabacitu comments... I think I should fix this issue by swapping the
|
Nope @kiddtang , this one is on our side :) unfortunately it slipped me, I have already sent a PR to fix it. Cheers |
Fixed in Laravel-Backpack/CRUD#4514 |
Bug report
After create a Role, when I want to edit, returns this error
Call to undefined method Spatie\Permission\Models\Permission::translationEnabled()
What I did:
Follows the guide
What I expected to happen:
Edit the role I've created
What happened:
Returns error Call to undefined method Spatie\Permission\Models\Permission::translationEnabled()
What I've already tried to fix it:
Backpack, Laravel, PHP, DB version:
Back Pack latests version 5.3
PHP 8.1
The text was updated successfully, but these errors were encountered: