laravel update only changed fields code example
Example 1: laravel model is dirty
if($product->isDirty()){
// changes have been made
}
Example 2: laravel update only changed fields
protected function performUpdate(Builder $query, array $options = [])
{
$dirty = $this->getDirty();
if (count($dirty) > 0)
{
// runs update query
}
return true;
}