我正在尝试在 Laravel 4.1 中使用 Elequent ORM 的软删除功能
删除记录按预期工作,但是当我使用 withTrashed() 搜索结果,然后检查它是否是使用rashed() 的软删除记录时,我收到以下错误
调用未定义的方法 Illuminate\Database\Eloquent\Collection::trashed()
这是我的代码。有什么建议么?
$product = Product::withTrashed()->where('url', Input::get("product_url.$key"))->where('prolist_id', $list->id)->get();
if($product->trashed())
{
$product->restore();
}