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

quyle92 liked this thread

1

$hidden is something completely different from $fillable and $guarded which are opposites. $fillable describes which fields can be mass assigned(via fill() method for example) while $guarded sets which fields can not be mass assigned so when you fill() with properties that are guarded they won't get saved in database. $hidden are fields that won't be shown when serializing model to JSON or array.

Regarding your questions

  • password, user_role, user_points $guarded
  • hidden does not mean guarded so if field is hidden and fillable it can obviously be fillable

lonerunner said: And/Or same input fields can't be set in both fillable and guarder or hidden and fillable. I guess guarded and hidden doesn't make sense?

Putting same field in guarded and fillable does not make sense. Mixing guarded or fillable with hidden does.

quyle92 liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

lonerunner lonerunner Joined 15 Jan 2015

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.