Merge pull request #702 from jitendra-webkul/jitendra

Jitendra
This commit is contained in:
Jitendra Singh 2019-03-15 19:07:55 +05:30 committed by GitHub
commit 947c1ab526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class ResourceController extends Controller
return $query;
});
if (! is_null(request()->input('pagination')) && request()->input('pagination')) {
if (is_null(request()->input('pagination')) || request()->input('pagination')) {
$results = $query->paginate(request()->input('limit') ?? 10);
} else {
$results = $query->get();

View File

@ -35,6 +35,7 @@ class Product extends JsonResource
'type' => $product->type,
'name' => $this->name,
'price' => $this->price,
'formated_price' => core()->currency($this->price),
'description' => $this->description,
'sku' => $this->sku,
'images' => ProductImage::collection($product->images),
@ -48,6 +49,10 @@ class Product extends JsonResource
$this->productPriceHelper->haveSpecialPrice($product),
$this->productPriceHelper->getSpecialPrice($product)
),
'formated_special_price' => $this->when(
$this->productPriceHelper->haveSpecialPrice($product),
core()->currency($this->productPriceHelper->getSpecialPrice($product))
),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];