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…试一下行不行

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案
3.14.0 - 2020-03-23 - BC
Please use v3.14.1 instead - this release is breaking because of the new column. There is also a v4.0.0-rc.1 release that equals to this one.

add \Spatie\Activitylog\ActivityLogger::event() method and column #702

github.com/spatie/laravel-activity...

3年前 评论
讨论数量: 2
Epona

第三方包?看看更新后是不是新加内容了。

3年前 评论
3.14.0 - 2020-03-23 - BC
Please use v3.14.1 instead - this release is breaking because of the new column. There is also a v4.0.0-rc.1 release that equals to this one.

add \Spatie\Activitylog\ActivityLogger::event() method and column #702

github.com/spatie/laravel-activity...

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!