Skip to content
activitylog / v1

Customising log options

Last updated:

If you want further customization of the logging options, you can override the getActivitylogOptions methods of the LogsActivity trait:

use Javaabu\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class Category extends Model {
    use LogsActivity;
    
    public function getActivitylogOptions(): LogOptions
    {
        /** @var Model $this */
        return LogOptions::defaults()
            ->logOnly(static::$logAttributes ?? ['*'])
            ->dontLogIfAttributesChangedOnly((static::$ignoreChangedAttributes ?? []))
            ->logExcept(array_merge($this->getHidden(), (static::$logExceptAttributes ?? [])))
            ->logOnlyDirty()
            ->dontSubmitEmptyLogs();
    }
}
Documentation
All packages

javaabu/activitylog

Source on GitHub