public function toArray($request): array 	{ 		$lang = $request->lang; 		$discount = $this->getDiscount(); 		$discountPrice = $this->applyDiscount($discount); 		$pricePerUnitOfMeasureDiscountPrice = $this->applyDiscountForPricePerUnitOfMeasure($discount);  		return [ 			'id' => $this->id, 			'type' => $this->type, 			'currency' => Setting::getMainCurrency(), 			'name' => $this->getTranslationIfExistsOrGiveNull($lang, 'name'), 			'slug' => $this->determineTranslation($lang, 'slug'), 			'slugs' => [ 				'hr' => $this->slug, 				'en' => $this->determineTranslation('en', 'slug'), 			], 			'seo' => [ 				'name' => $this->determineTranslation($lang, 'seo_name'), 				'description' => $this->determineTranslation($lang, 'seo_description'), 			], 			'description' => $this->getTranslationIfExistsOrGiveNull($lang, 'description'), 			'short_description' => $this->determineTranslation($lang, 'short_description'), 			'price' => $this->price, 			'price_with_discount' => $discountPrice ? number_format((float) $discountPrice, 2) : null, 			'second_price' => $this->getSecondPrice($this->price), 			'second_price_with_discount' => $this->getSecondPrice($discountPrice), 			'price_per_unit_of_measure' => $this->price_per_unit_of_measure, 			'price_per_unit_of_measure_with_discount' => $pricePerUnitOfMeasureDiscountPrice ? number_format((float) $pricePerUnitOfMeasureDiscountPrice, 2) : null, 			'second_price_per_unit_of_measure' => $this->getSecondPrice((string) $this->price_per_unit_of_measure), 			'second_price_per_unit_of_measure_with_discount' => $this->getSecondPrice($pricePerUnitOfMeasureDiscountPrice), 			'alternative_unit_of_measure' => $this->alternative_unit_of_measure, 			'lowest_price' => $this->lowest_price, 			'second_lowest_price' => $this->getSecondPrice((string) $this->lowest_price), 			'availability' => $this->availabilityStatus(), 			'variant_label' => $this->determineTranslation($lang, 'variant_label'), 			'vat_rate' => $this->getVatRate(), 			'code' => $this->code, 			'harvest' => $this->harvest, 			'weight' => $this->weight, 			'quantity' => $this->quantity, 			'stock' => $this->stock, 			'variants' => ProductVariantResource::collection($this->variants), 			'applied_discount' => new DiscountResource($discount), 			'piktograms' => $this->fetchPiktograms($discount), 			'category' => ProductCategoryResource::collection($this->productCategories), 			'filters' => ProductFilterResource::collection($this->productFilters), 			'media' => ['images' => MediaResource::collection($this->storage()->files('images')), 				'nutritional_table' => $this->storage()->getFirstThumb('nutrition'), 			], 			'rating' => $this->reviews_avg_rating ? round($this->reviews_avg_rating, 2) : null, 			'user_liked' => $this->hasUserLiked(), 			'can_be_reviewed' => getUser() ? getUser()->user->canReviewProduct($this->id) : false, 			'tags' => TagItemResource::collection($this->tags), 			'unit_of_measure' => Product::MEASURE_UNITS[$this->unit_of_measure], 			'reviews_count' => $this->reviewsCount(), 			'created_at' => formatTimestamp($this->created_at), 			'updated_at' => formatTimestamp($this->updated_at), 		]; 	}