lumen SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list'

文章目录

      • 场景
      • 分析
      • 解决

场景

  • 定义了一个Model ,这个Model不存在updated_at字段; 但是插入的时候 insert (updated_at ) values() 导致报了上面的错误

分析

  • 触发了laravel的内置规则
  • 官方文档 By default, Eloquent expects created_at and updated_at columns to exist on your tables. If you do not wish to have these columns automatically managed by Eloquent, set the $timestamps property on your model to false:

解决

  • public $timestamps = false;

你可能感兴趣的:(laravel,lumen,timestamps,laravel)