eloquent is dirty code example
Example 1: laravel model is dirty
if($product->isDirty()){
// changes have been made
}
Example 2: check if value change laravel
If you want to check if the model is dirty just call isDirty():
if($product->isDirty()){
// changes have been made
}
Or if you want to check a certain attribute:
if($product->isDirty('price')){
// price has changed
}
refrence: https://stackoverflow.com/questions/28866500/laravel-eloquent-update-just-if-changes-have-been-made