From 7636ae471592db8a69e44449ec5aa267769d8ee2 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Mon, 19 Jun 2023 20:31:02 +0300 Subject: [PATCH] Fix Cart.getItem() method. --- app/Models/Cart.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Models/Cart.php b/app/Models/Cart.php index b9ee7a8..e3b7c2e 100644 --- a/app/Models/Cart.php +++ b/app/Models/Cart.php @@ -50,11 +50,10 @@ class Cart extends Model { $itemsIds = $this->getItemIds(); - $itemId = Item::whereIn('id', $itemsIds) - ->where('uuid', $name) - ->count(); + $item = Item::whereIn('id', $itemsIds) + ->where('name', $name)->first(); - return Item::where('id', $itemId)->first(); + return $item; } public function getItemIds(): array