diff --git a/app/Models/Cart.php b/app/Models/Cart.php index e005c23..0163326 100644 --- a/app/Models/Cart.php +++ b/app/Models/Cart.php @@ -56,6 +56,20 @@ class Cart extends Model return $item; } + public function getItemJSON() + { + $items = $this->items; + $itemJSON = []; + + foreach($items as $item) + array_push($itemJSON, [ + 'id' =>$item->uuid, + 'count'=> $item->count + ]); + + return $itemJSON; + } + public function getItemIds(): array { return $this->items()->pluck('item_id')->toArray();