From b0604801795cab9a649dc7f0f15c5034ff2301fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 2 Jan 2021 11:53:48 +0300 Subject: [PATCH] fixed item tax in api --- app/Http/Controllers/Api/Common/Items.php | 2 +- app/Transformers/Common/Item.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/Common/Items.php b/app/Http/Controllers/Api/Common/Items.php index a9f5287c63..b8eabde3b3 100644 --- a/app/Http/Controllers/Api/Common/Items.php +++ b/app/Http/Controllers/Api/Common/Items.php @@ -22,7 +22,7 @@ class Items extends ApiController */ public function index() { - $items = Item::with('category', 'tax')->collect(); + $items = Item::with('category', 'taxes')->collect(); return $this->response->paginator($items, new Transformer()); } diff --git a/app/Transformers/Common/Item.php b/app/Transformers/Common/Item.php index a541c6baad..873d877d9c 100644 --- a/app/Transformers/Common/Item.php +++ b/app/Transformers/Common/Item.php @@ -46,7 +46,7 @@ public function includeTaxes(Model $model) return $this->null(); } - return $this->item($model->taxes, new Tax()); + return $this->collection($model->taxes, new Tax()); } /**