commit
947c1ab526
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue