You've already forked Epicnabbo-Catalogus-Updated-Daily
2.3 KiB
2.3 KiB
From v3 to v4
composer require spatie/laravel-activitylog "^4.0.0"
Publish migrations & migrate new tables
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan migrate
Model event Logging
- All models now need to define a
getActivitylogOptions()method to configure and return the models options as aLogOptionsinstance. - To control what attributes are logged, instead of defining a
$logAttributesproperty this is defined in thegetActivitylogOptions()method using thelogOnly()method ofLogOptions. - The
getDescriptionForEvent()method is no longer used to customize the description. Instead, use thesetDescriptionForEvent()method forLogOptionsclass. - When customizing the log's name instead of defining a
$logNameproperty, call theuseLogName()method when configuring theLogOptions. - Instead of the
$ignoreChangedAttributesproperty thedontLogIfAttributesChangedOnly()method should be used. - If you only need to log the dirty attributes use
logOnlyDirty()since the$logOnlyDirtyproperty is no longer used. - For instances where you do not want to store empty log events use
dontSubmitEmptyLogs()instead of setting$submitEmptyLogstofalse. - When you use a
*(wildcard) and want to ignore specific elements use thedontLogIfAttributesChangedOnly()method instead of the$logAttributesToIgnoreproperty.
From v2 to v3
- if you are using a custom
Activitymodel, you should let it implement the newSpatie\Activitylog\Contracts\Activityinterface - the preferred way to get changes on an
Activitymodel is through thechangesproperty instead of thechanges()function. Change all usages from$activity->changes()to$activity->changes - the
activityrelation of theCausesActivitytrait has been renamed toactions. Rename all uses from$user->activityto$user->actions - the
activityrelation of theLogsActivitytrait has been renamed toactivities. Rename all uses from$yourModel->activityto$yourModel->activities. - the deprecated
loggedActivityrelation has been removed. Useactivitiesinstead. - the
HasActivitytrait has been removed. Use bothCausesActivityandLogsActivitytraits instead.