ActivityLog 突然报错 冒出一个event字段,之前一直好好的。
日志:
Column not found: 1054 Unknown column 'event' in 'field list' (SQL: insert into `activity_log` (`log_name`, `properties`, `causer_id`, `causer_type`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values (活动竞赛审核, [], 1, App\Models\User, created, 19, App\Models\ContestVerify, 新增, 2020-08-06 09:06:48, 2020-08-06 09:06:48))
众所周知 activityLog 数据字段中并没有event 字段,为什么会突然 出现一个event呢。。。。
Model 中 代码:
use LogsActivity;
protected static $logName = 'xxxx';
protected static $logUnguarded = true;//记录修改的字段
protected static $logOnlyDirty = true;//只记录修改的字段json
public function getDescriptionForEvent(string $eventName): string
{
switch ($eventName) {
case 'created':
$description = '新增';
break;
case 'updated':
$description = '修改';
break;
case 'deleted':
$description = '删除';
break;
default:
$description = $eventName;
break;
}
return $description;
}
我现在正在卸载重新安装 activitylog…试一下行不行
推荐文章: