Merge pull request #4660 from rahulshukla-webkul/development

Issue #4643 fixed
This commit is contained in:
Glenn Hermans 2021-02-19 11:50:13 +01:00 committed by GitHub
commit 9176fed0fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 6 deletions

View File

@ -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,

View File

@ -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
];
}
}

View File

@ -72,9 +72,10 @@ class SubscriptionController extends Controller
$customer = $subscriber->customer;
$customer->subscribed_to_news_letter = $data['is_subscribed'];
$customer->save();
if (! is_null($customer)) {
$customer->subscribed_to_news_letter = $data['is_subscribed'];
$customer->save();
}
$result = $subscriber->update($data);

View File

@ -1,2 +0,0 @@
*
!.gitignore