mysql - Laravel 5.4 save NULL to database not working -
the following code results in empty value inside database , when out of database empty string.
$customer->update(['company' => null]);
you should consider 3 things:
1) make sure company
column in nullable
in table. if it's not won't possible put null
in there.
2) make sure have in $fillable
property of customer
model column company
3) verify don't have mutator in customer
model - verify don't have setcompanyattribute
method might change value automatically empty string if it's set null
Comments
Post a Comment