category default limit

This commit is contained in:
merdan 2022-03-10 13:24:15 +05:00
parent 9089514edd
commit 94b891c66e
3 changed files with 22 additions and 99 deletions

View File

@ -3,6 +3,7 @@
namespace Sarga\API\Http\Resources\Customer;
use Illuminate\Http\Resources\Json\JsonResource;
use Sarga\API\Http\Resources\Checkout\CartItemProduct;
class OrderItemResource extends JsonResource
{
@ -19,7 +20,7 @@ class OrderItemResource extends JsonResource
'sku' => $this->sku,
'type' => $this->type,
'name' => $this->name,
'product_id' => $this->product_id,
'product' => $this->when($this->product_id, new CartItemProduct($this->product)),
'coupon_code' => $this->coupon_code,
'weight' => (double) $this->weight,
'total_weight' => $this->total_weight,
@ -29,28 +30,28 @@ class OrderItemResource extends JsonResource
'qty_shipped' => (int) $this->qty_shipped,
'qty_refunded' => (int) $this->qty_refunded,
'price' => (double) $this->price,
'formated_price' => core()->formatPrice($this->base_price, $this->order->order_currency_code),
'formatted_price' => core()->formatPrice($this->base_price, $this->order->order_currency_code),
'total' => $this->total,
'formated_total' => core()->formatPrice($this->base_total, $this->order->order_currency_code),
'formatted_total' => core()->formatPrice($this->base_total, $this->order->order_currency_code),
'total_invoiced' => $this->total_invoiced,
'formated_total_invoiced' => core()->formatPrice($this->base_total_invoiced, $this->order->order_currency_code),
'formatted_total_invoiced' => core()->formatPrice($this->base_total_invoiced, $this->order->order_currency_code),
'amount_refunded' => $this->amount_refunded,
'formated_amount_refunded' => core()->formatPrice($this->base_amount_refunded, $this->order->order_currency_code),
'formatted_amount_refunded' => core()->formatPrice($this->base_amount_refunded, $this->order->order_currency_code),
'discount_percent' => $this->discount_percent,
'discount_amount' => (double) $this->discount_amount,
'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order->order_currency_code),
'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order->order_currency_code),
'discount_invoiced' => $this->discount_invoiced,
'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order->order_currency_code),
'formatted_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order->order_currency_code),
'discount_refunded' => $this->discount_refunded,
'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order->order_currency_code),
'formatted_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order->order_currency_code),
'grant_total' => $this->total + $this->tax_amount,
'formated_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code),
'formatted_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code),
'downloadable_links' => $this->downloadable_link_purchased,
'additional' => is_array($this->resource->additional)
? $this->resource->additional

View File

@ -25,7 +25,6 @@ class OrderResource extends JsonResource
public function toArray($request){
return [
'id' => $this->id,
'increment_id' => $this->increment_id,
'status' => $this->status,
'status_label' => $this->status_label,
'customer_first_name' => $this->customer_first_name,
@ -42,40 +41,40 @@ class OrderResource extends JsonResource
'channel_currency_code' => $this->channel_currency_code,
'order_currency_code' => $this->order_currency_code,
'grand_total' => (double)$this->grand_total,
'formated_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code),
'formatted_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code),
'grand_total_invoiced' => (double)$this->grand_total_invoiced,
'formated_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code),
'formatted_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code),
'grand_total_refunded' => (double)$this->grand_total_refunded,
'formated_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code),
'formatted_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code),
'sub_total' => (double)$this->sub_total,
'formated_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code),
'formatted_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code),
'sub_total_invoiced' => (double)$this->sub_total_invoiced,
'formated_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code),
'formatted_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code),
'sub_total_refunded' => (double)$this->sub_total_refunded,
// 'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code),
// 'formatted_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code),
'discount_percent' => $this->discount_percent,
'discount_amount' => (double)$this->discount_amount,
'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code),
'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code),
'discount_invoiced' => (double)$this->discount_invoiced,
'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code),
'formatted_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code),
'discount_refunded' => (double)$this->discount_refunded,
'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code),
'formatted_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code),
'shipping_amount' => (double)$this->shipping_amount,
'formated_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code),
'formatted_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code),
'shipping_invoiced' => $this->shipping_invoiced,
'formated_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code),
'formatted_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code),
'shipping_refunded' => $this->shipping_refunded,
'formated_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code),
'formatted_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code),
'shipping_address' => new OrderAddressResource($this->shipping_address),
'billing_address' => new OrderAddressResource($this->billing_address),

View File

@ -1,77 +0,0 @@
<?php
namespace Sarga\API\Http\Resources\Sales;
use Illuminate\Http\Resources\Json\JsonResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Customer\CustomerResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Sale\InvoiceResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Sale\OrderAddressResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Sale\OrderItemResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Sale\ShipmentResource;
use Webkul\RestApi\Http\Resources\V1\Admin\Setting\ChannelResource;
class Order extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'increment_id' => $this->increment_id,
'status' => $this->status,
'status_label' => $this->status_label,
'customer_first_name' => $this->customer_first_name,
'customer_last_name' => $this->customer_last_name,
'shipping_method' => $this->shipping_method,
'shipping_title' => $this->shipping_title,
'payment_title' => core()->getConfigData('sales.paymentmethods.' . $this->payment->method . '.title'),
'shipping_description' => $this->shipping_description,
'coupon_code' => $this->coupon_code,
'total_item_count' => $this->total_item_count,
'total_qty_ordered' => $this->total_qty_ordered,
'grand_total' => $this->grand_total,
'formated_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code),
'grand_total_invoiced' => $this->grand_total_invoiced,
'formated_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code),
'grand_total_refunded' => $this->grand_total_refunded,
'formated_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code),
'sub_total' => $this->sub_total,
'formated_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code),
'sub_total_invoiced' => $this->sub_total_invoiced,
'formated_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code),
'sub_total_refunded' => $this->sub_total_refunded,
'discount_percent' => $this->discount_percent,
'discount_amount' => $this->discount_amount,
'formated_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->order_currency_code),
'discount_invoiced' => $this->discount_invoiced,
'formated_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code),
'discount_refunded' => $this->discount_refunded,
'formated_discount_refunded' => core()->formatPrice($this->base_discount_refunded, $this->order_currency_code),
'tax_amount' => $this->tax_amount,
'formated_tax_amount' => core()->formatPrice($this->base_tax_amount, $this->order_currency_code),
'tax_amount_invoiced' => $this->tax_amount_invoiced,
'formated_tax_amount_invoiced' => core()->formatPrice($this->base_tax_amount_invoiced, $this->order_currency_code),
'tax_amount_refunded' => $this->tax_amount_refunded,
'formated_tax_amount_refunded' => core()->formatPrice($this->base_tax_amount_refunded, $this->order_currency_code),
'shipping_amount' => $this->shipping_amount,
'formated_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code),
'shipping_invoiced' => $this->shipping_invoiced,
'formated_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code),
'shipping_refunded' => $this->shipping_refunded,
'formated_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code),
'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)),
'shipping_address' => new OrderAddressResource($this->shipping_address),
'billing_address' => new OrderAddressResource($this->billing_address),
'items' => OrderItemResource::collection($this->items),
'invoices' => InvoiceResource::collection($this->invoices),
'shipments' => ShipmentResource::collection($this->shipments),
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
];
}
}