Skip to content

Commit

Permalink
update docs for json mass assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 2, 2020
1 parent 81f8727 commit e61c0bb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,19 @@ If you already have a model instance, you may use the `fill` method to populate

$flight->fill(['name' => 'Flight 22']);

#### Mass Assignment & JSON Columns

When assigning JSON columns, each column mass-assignable key must be specified in your model's `$fillable` array. For security, Laravel does not support updating nested JSON attributes when using the `guarded` property:

/**
* The attributes that are mass assignable.
*
* @var array
*/
$fillable = [
'options->enabled',
];

#### Allowing Mass Assignment

If you would like to make all attributes mass assignable, you may define the `$guarded` property as an empty array:
Expand Down

0 comments on commit e61c0bb

Please sign in to comment.