Why the Laravel trashed () method was not found>

I am trying to use Elequent ORM soft delete functionality in Laravel 4.1

Deleting records works as expected, however, when I search for results using Trashed () and then check if it was a soft remote record using trashed (), I get the following error:

Method call undefined Illuminate \ Database \ eloquent \ Collection :: Thugs ()

Here is my code. Any suggestions?

$product = Product::withTrashed()->where('url', Input::get("product_url.$key"))->where('prolist_id', $list->id)->get();

if($product->trashed())
{
    $product->restore();
}
+4
source share
1 answer

get() . , first() trashed(). , .

+4

Source: https://habr.com/ru/post/1540568/


All Articles