We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
isDirty()
getDirty()
unset
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.
The text was updated successfully, but these errors were encountered:
Fixed by #2578
Sorry, something went wrong.
No branches or pull requests
While testing we have determined that if you do
however if you set it to null
The reason for this is that
isDirty()
callsgetDirty()
https://github.com/laravel/framework/blob/5.3/src/Illuminate/Database/Eloquent/Model.php#L3220 which loops over the current attributes. If the attribute isunset
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.
The text was updated successfully, but these errors were encountered: