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
@TimFoerster thanks for this fix, however, I think the issue actually lies with the Location plugin. This plugin makes the User model use the LocationModel behavior, as seen here. This behavior is supposed to already make the state_id and country_id fillable, as this code block shows. I suspect that something is preventing this from running.
The only case that is not supported is if the developer overrides both $fillable and $guarded. This seems acceptable to me, since the docs explicitly state:
Of course, you should use either $fillable or $guarded - not both
The October\Rain\Auth\Models\User class defines a $guarded property, making everything except for those fields writable.
The RainLab\User\Models\User classes, which extends the model above, then defines a $fillable property, which reverses this and makes only those fields writable.
The RainLab\Location\Behaviors\LocationModel class only makes the required state/country fields fillable if $guarded is set to ['*'].
So the simple fix would be to set $guarded to ['*'] in the RainLab\User\Models\User class, as this is already implied by it setting the $fillable property anyway. Would you care to submit a PR with that to the User plugin?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #34