Json keys fillable is ignoring #53881
-
Please tell me where I'm going wrong? I persistently created a issue in the laravel/framework repository, but they ignore me. class MyModel extends Model
{
protected $fillable = [
'name',
'data->some_value'
];
}
$model = MyModel::create([
'name' => 'Some name',
'data' => ['some_value' => 1]
]);
//got `null` (`$fillable` ignored)
dd($model->data); Its already is documented, must works, but not working =\ |
Beta Was this translation helpful? Give feedback.
Answered by
macropay-solutions
Dec 13, 2024
Replies: 1 comment 5 replies
-
This should be resolved as of #53878 (comment): "you must use the key exactly the same in the fill array with '->'..." so you must use |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@marius-mcp It could be if you put there all the allowed keys and you create with each of those allowed keys
'col->key' => 1,
'col->key2' => 2,
instead of creating with a single 'col' => json or ['key' => 1, 'key2' =>2]