未设置空间活动日志名称



我正在使用以下软件包:https://spatie.be/docs/laravel-activitylog/v4/introduction

我能够完美地表演每一件事,除了设置";日志名称"在";activity_log";桌子不管我的尝试如何,它仍然设置为默认的";默认";。在这个例子中,我试图将其设置为"0";应用程序";。

Application.php

use SpatieActivitylogTraitsLogsActivity;
use HasFactory, Notifiable, LogsActivity;
protected static $logName = 'applications';
protected static $logAttributes = ['*'];
protected static $logOnlyDirty = true;
protected static $logAttributesToIgnore = ['updated_at', 'survey_key'];
protected static $recordEvents = ['updated', 'deleted'];

和我的ApplicationController.php

activity()
->causedBy(Auth::user()->id)
->performedOn($app)
->withProperties([
'employers' => $request->employers
])
->log('Nudge sent to ' . count($request->employers) . ' Employers.');

我也尝试过getActivitlogOptions:

public function getActivitylogOptions()
{
return LogOptions::defaults()
->useLogName('applications')
->logAttributes(['*'])
->logOnlyDirty(true)
->logAttributesToIgnore(['updated_at', 'survey_key'])
->recordEvents(['deleted'])
->setDescriptionForEvent(fn(string $eventName) => "Application has been {$eventName}")
->dontLogIfAttributesChangedOnly(['text']);
}

我通过:实现了它

activity('applications')
->causedBy(Auth::user()->id)
->performedOn($app)
->withProperties([
'employers' => $request->employers
])
->log('Nudge sent to ' . count($request->employers) . ' Employers.');

最新更新