Issue #4645 fixed and product videos added in product api
This commit is contained in:
parent
e581c950df
commit
ea66157655
|
|
@ -17,6 +17,8 @@ class Product extends JsonResource
|
|||
$this->productReviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
|
||||
$this->wishlistHelper = app('Webkul\Customer\Helpers\Wishlist');
|
||||
|
||||
parent::__construct($resource);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +47,8 @@ class Product extends JsonResource
|
|||
'formated_price' => core()->currency($productTypeInstance->getMinimalPrice()),
|
||||
'short_description' => $product->short_description,
|
||||
'description' => $product->description,
|
||||
'images' => ProductImageFacade::collection($product->images),
|
||||
'images' => ProductImage::collection($product->images),
|
||||
'videos' => ProductVideo::collection($product->videos),
|
||||
'base_image' => ProductImageFacade::getProductBaseImage($product),
|
||||
'created_at' => $product->created_at,
|
||||
'updated_at' => $product->updated_at,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Catalog;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ProductVideo extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'url' => $this->url
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue