You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the setPermissionsAttribute() mutator tries to save the model, it is not possible to create a new role along with permissions using the create method ("Integrity constraint violation: 1062 Duplicate entry"). In my opinion mutators are not meant to communicate with database at all.
There are at least two solutions. You could resign from saving the model within the mutator or guard "permissions" attribute (disable mass assignment).
Great package btw. Thank you 🏅
The text was updated successfully, but these errors were encountered:
andrzejkupczyk
changed the title
🐛 Permissions mutator should not try to save the role
🐛 Permissions mutator should not try to save the role
Jul 2, 2020
Since the
setPermissionsAttribute()
mutator tries to save the model, it is not possible to create a new role along with permissions using thecreate
method ("Integrity constraint violation: 1062 Duplicate entry"). In my opinion mutators are not meant to communicate with database at all.This is an example of code that does not work:
There are at least two solutions. You could resign from saving the model within the mutator or guard "permissions" attribute (disable mass assignment).
Great package btw. Thank you 🏅
The text was updated successfully, but these errors were encountered: