From 62b9944c58358926b7cacb7a1c5a331c2e8a4792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Mon, 28 Oct 2024 09:07:16 +0100 Subject: [PATCH] Added missing published --- app/Http/Resources/ProductResource.php | 7 ------- app/Http/Resources/ProductWithoutSalesResource.php | 1 + tests/Feature/ProductTest.php | 3 +++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/Http/Resources/ProductResource.php b/app/Http/Resources/ProductResource.php index 0add58ac5..9b2dcb3d9 100644 --- a/app/Http/Resources/ProductResource.php +++ b/app/Http/Resources/ProductResource.php @@ -10,13 +10,6 @@ */ class ProductResource extends ProductWithoutSalesResource { - public function base(Request $request): array - { - return array_merge(parent::base($request), [ - 'published' => $this->resource->published, - ]); - } - public function view(Request $request): array { return array_merge(parent::view($request), [ diff --git a/app/Http/Resources/ProductWithoutSalesResource.php b/app/Http/Resources/ProductWithoutSalesResource.php index 90eab4c00..cf550c260 100644 --- a/app/Http/Resources/ProductWithoutSalesResource.php +++ b/app/Http/Resources/ProductWithoutSalesResource.php @@ -61,6 +61,7 @@ public function base(Request $request): array 'purchase_limit_per_user' => $this->resource->purchase_limit_per_user, 'description_html' => $this->when($request->boolean('with_description'), $this->resource->description_html), 'gallery' => $this->when($request->boolean('with_gallery'), MediaResource::collection($this->resource->media)), + 'published' => $this->resource->published, ]; return array_merge( diff --git a/tests/Feature/ProductTest.php b/tests/Feature/ProductTest.php index dfcbdeeb6..15dc2c489 100644 --- a/tests/Feature/ProductTest.php +++ b/tests/Feature/ProductTest.php @@ -238,6 +238,9 @@ public function setUp(): void 'metadata' => [ $metadata->name => $metadata->value, ], + 'published' => [ + $this->lang, + ], ]); $this->saleProduct = Product::factory()->create([