From c0d89c9d2f1907bc7e7dae280986fb19455c81eb Mon Sep 17 00:00:00 2001 From: Rob Gloudemans Date: Thu, 14 Jul 2016 10:05:20 +0200 Subject: [PATCH] Always return a Collection when searching --- src/Cart.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Cart.php b/src/Cart.php index e168621..f0699d8 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -285,17 +285,13 @@ class Cart * Search the cart content for a cart item matching the given search closure. * * @param \Closure $search - * @return \Gloudemans\Shoppingcart\CartItem|\Illuminate\Support\Collection + * @return \Illuminate\Support\Collection */ public function search(Closure $search) { $content = $this->getContent(); - $found = $content->filter($search); - - if($found->count() === 1) return $found->first(); - - return $found; + return $content->filter($search); } /**