Closed
Description
While testing we have determined that if you do
$model->attribute = 'blah';
$model->save();
$model->unset('attribute');
$model->isDity(); // will return false
however if you set it to null
$model->attribute = 'blah';
$model->save();
$model->attribute = null;
$model->isDity(); // will return true
The reason for this is that isDirty()
calls getDirty()
https://github.com/laravel/framework/blob/5.3/src/Illuminate/Database/Eloquent/Model.php#L3220 which loops over the current attributes. If the attribute is unset
then it will not look at it.
So if you want to know if your object isDirty() you really should use null unless a trait or something is used with unset to mark it as dirty.