所以在我的 SQL 中,我的表只包含三个字段——行 ID、人员 ID 和状态 ID,我想使用 Laravel 模型添加新行,当我使用
$a = new AssignedStatus;
$a->person_id = $person_id;
$a->status_id = $status_id;
$a->save();
我收到 SQL 错误,提示在该表中找不到列“created_at”和“updated_at”。是否有可能摆脱它们并只插入行,或者使用 DB::table
连接更容易?
最佳答案
在 AssignedStatus 模型中你需要声明:
public $timestamps = false
关于php - Eloquent 模型添加没有 "created_at"和 "updated_at"字段的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38159945/