在删除softDelete之后,Laravel仍然希望找到delete_at列 [英] Laravel still expects to find deleted_at column after I remove softDelete

查看:169
本文介绍了在删除softDelete之后,Laravel仍然希望找到delete_at列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过这种迁移,我刚刚从表中删除了softDelete:

I just removed softDelete from a table with this migration:

   Schema::table("items", function ($table) {
      $table->dropSoftDeletes();
   });

但是现在每个查询的结果是:

But now every query results in:

Column not found: 1054 Unknown column 'items.deleted_at' in 'where clause' 

代码在任何地方均未明确引用此列.它是否已缓存在某个地方?如果是,如何清除它?

Nowhere does the code explicitly refer to this column. Has it been cached somewhere, and if so, how to clear it?

推荐答案

您还需要从模型中删除特征:

You also need to remove the trait from the model:

use SoftDeletes;

来自文档:

要为模型启用软删除,请使用模型上的 Illuminate \ Database \ Eloquent \ SoftDeletes 特性

这篇关于在删除softDelete之后,Laravel仍然希望找到delete_at列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆