Mal*_*ndo 0 soft-delete laravel eloquent laravel-5
在我的表中,我没有 delete_at 列。
但在 Laravel 模型中,在 where 条件下,deleted_at 返回 null。
下面是我的代码
public function load($id) {
return $this
->select(sprintf('%s.*', $this->getTable()))
->where(sprintf('%s.id', $this->getTable(), $this->getKeyName()), '=', $id)
->first();
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我吗?如何解决这个问题?
Mad*_*tel 10
您必须use SoftDeletes;从模型文件中删除特征。
然后使用以下代码:
return $this->where(sprintf('%s.id', $this->getTable(), $this->getKeyName()), '=', $id)
->pluck('id');'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4803 次 |
| 最近记录: |