Boolean not saving with underscore in field name.
I'm working with a legacy database that has some tinytext/boolean fields that begin with "_field_name". [leading underscore]
I have set casting on model to
boolean
yet they do not save/update. I cannot change the field names.
I think somewhere the underscore is being stripped off. Any ideas how to fix this?4 Replies
if it was stripped you would have an error bc missing database column
are you sure its $fillable or something?
I just spit out from
mutateFormDataBeforeSave
and can see it's working at that point...so i went next level and dd() inside Laravels updating
lifecycle... that's where it is not right. I think its a Laravel naming convention thing
looks like it's Laravel, not filament. 🤔
inside filament mutateFormDataBeforeSave
I get $data['_hide'] == true
but inside model updating
I get $model->_hide = 0;Stack Overflow
Eloquent not allowing fields starting with an underscore
Eloquent explicitly rejects fields/columns starting with an underscore
https://github.com/laravel/framework/blob/7212b1e9620c36bf806e444f6931cf5f379c68ff/src/Illuminate/Database/Eloquent/Concerns/
yeah, just figured it out
I had
but I needed to explicitly set them:
sigh, thanks Dan