src/Observers/BaseObserver.php
protected function getDiff($model)
    {
        $dirty = $model->getDirty();
        $fresh = $model->fresh() ? $model->fresh()->toArray() : []; 
        $after = json_encode($dirty);
        $before = json_encode(array_intersect_key($fresh, $dirty));

        return compact('before', 'after');
    }
protected function getDiff($model)
    {
        $dirty = $model->getDirty();
        $fresh = $model->fresh() ? $model->fresh()->toArray() : []; 
        $after = json_encode($dirty);
        $before = json_encode(array_intersect_key($fresh, $dirty));

        return compact('before', 'after');
    }
protected function getDiff ( $ model ) { $ dirty = $ model -> getDirty ( ) ; $ fresh = $ model -> fresh ( ) ? $ model -> fresh ( ) -> toArray ( ) : [ ] ; $ after = json_encode ( $ dirty ) ; $ before = json_encode ( array_intersect_key ( $ fresh , $ dirty ) ) ; return compact ( 'before' , 'after' ) ; }
Get diff between dirty and fresh model attributes.

@param \Illuminate\Database\Eloquent\Model $model The Eloquent model.

@return void
Get diff between dirty and fresh model attributes .