Support the ongoing development of Laravel.io →
Security Database Eloquent
Last updated 2 years ago.
0

yes, just add a fillable array in the model.

0

Just an added not about this. Just read:

Guarded checks if the field is guarded or not. If the field is not in the guarded array it assumes its ok and assign the value which can cause errors if the field does not exists.

Fillable is checked first so if the field is in the fillable array it will assign the value, if not just silently fail it.

So fillable is much less prone to errors caused by the form trying to insert data into a field that does not exist. As a rule just set both guarded and fillable!

Gav.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

minerbog minerbog Joined 15 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.