Closed agyto closed 8 years ago
it's turn error when i declare a variable before use Cart::search() method,
$var = 1; Cart::instance('_wishlist')->search(function ($cartItem, $rowId) { if($cartItem->id === $var){ return $var; } }
i try use passing method by filter() on Laravel, but same result
$var = 1; Cart::instance('_wishlist')->content()->filter(function ($cartItem) { if($cartItem->id === $var){ return $var; } }
That's because the $var is set in another scope. Look at the php documentation, you'll have to add a 'use' keyword to add the variable to the scope of the closure.
it's turn error when i declare a variable before use Cart::search() method,
i try use passing method by filter() on Laravel, but same result