Spatie\Activitylog\Traits\DetectsChanges::bootDetectsChanges PHP Method

bootDetectsChanges() protected static method

protected static bootDetectsChanges ( )
    protected static function bootDetectsChanges()
    {
        if (static::eventsToBeRecorded()->contains('updated')) {
            static::updating(function (Model $model) {
                //temporary hold the original attributes on the model
                //as we'll need these in the updating event
                $oldValues = $model->replicate()->setRawAttributes($model->getOriginal());
                $model->oldAttributes = static::logChanges($oldValues);
            });
        }
    }