updateOrCreate()注意项

updateOrCreate()默认的主键是id,如果自增主键名不是id就要在模型中声明主键

protected $primaryKey = 'categories_description_id';
不然使用updateOrCreate()进行新增数据将无法新增,报错Column not found: 1054 Unknown column 'id' in 'where clause'
原文地址:https://www.cnblogs.com/xiaofeilin/p/14953920.html