tighten / parental

Use single table inheritance in your Laravel app
MIT License
1.36k stars 98 forks source link

Bypass Totally Guarded Exception in HasChildren@getChildModel #68

Closed nathanheffley closed 1 year ago

nathanheffley commented 5 years ago

I noticed that if a model is totally guarded (it has no fillable properties and the guarded array is equal to ['*'] then getChildModel() in the HasChildren trait will throw a Mass Assignment Exception when doing actions like ParentModel::first().

You can get around this by setting your fillable array to literally anything (I currently have mine as such: protected $fillable = ['not_totally_guarded'];) and everything will work fine from what I can tell.

Not a huge inconvenience for models that you want to be totally guarded, but it would be nice if the package could do something differently to bypass this unnecessary exception.

mattstauffer commented 1 year ago

Hey friends! The team at Tighten has taken Parental back over and we're re-opening the issue tracker, but to give us a clean slate, I'm going to close all old issues that remain from when Caleb closed the issue tracker in 2020. If this is still an outstanding concern with the latest version of Parental, please feel free to open a new issue referencing this one.

Thank you!