0, 'name' => '', 'price' => 0, 'price_ttc' => 0, 'discount_value' => 0, 'discount_rate' => 0, 'discounted_price' => 0, 'undiscounted_price_ttc' => 0, ]; /** * ProductResource * * @param \App\Models\Merchandise\Product $product */ public function __construct(Product $product) { $this->product = $product; } /** * Transform the resource into an array. * * @param mixed $request * @return array * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function toArray($request) { // phpcs:enable return array_intersect_key( array_merge( [ 'price' => $this->product->price, 'price_ttc' => $this->product->price_ttc, 'discount_value' => $this->product->discount_value, 'discount_rate' => $this->product->discount_rate, 'discounted_price' => $this->product->discounted_price, 'undiscounted_price_ttc' => $this->product->undiscounted_price_ttc ], $this->product->toArray(), ), $this->skeleton ); } }