diff --git a/packages/Webkul/API/Http/Controllers/Shop/AddressController.php b/packages/Webkul/API/Http/Controllers/Shop/AddressController.php index 863710ac0..705d716ad 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/AddressController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/AddressController.php @@ -62,6 +62,7 @@ class AddressController extends Controller public function get() { $customer = auth($this->guard)->user(); + $addresses = $customer->addresses()->get(); return CustomerAddressResource::collection($addresses); diff --git a/packages/Webkul/API/Http/Controllers/Shop/CartController.php b/packages/Webkul/API/Http/Controllers/Shop/CartController.php index 8e76ef534..637fcc290 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CartController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CartController.php @@ -110,8 +110,9 @@ class CartController extends Controller ], 400); } - if ($customer = auth($this->guard)->user()) + if ($customer = auth($this->guard)->user()) { $this->wishlistRepository->deleteWhere(['product_id' => $id, 'customer_id' => $customer->id]); + } Event::dispatch('checkout.cart.item.add.after', $result); @@ -121,7 +122,7 @@ class CartController extends Controller return response()->json([ 'message' => 'Product added to cart successfully.', - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null ]); } @@ -156,7 +157,7 @@ class CartController extends Controller return response()->json([ 'message' => 'Cart updated successfully.', - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null ]); } @@ -177,7 +178,7 @@ class CartController extends Controller return response()->json([ 'message' => 'Cart removed successfully.', - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null ]); } @@ -201,7 +202,7 @@ class CartController extends Controller return response()->json([ 'message' => 'Cart removed successfully.', - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null ]); } @@ -225,7 +226,7 @@ class CartController extends Controller return response()->json([ 'message' => 'Cart item moved to wishlist successfully.', - 'data' => $cart ? new CartResource($cart) : null + 'data' => $cart ? new CartResource($cart) : null ]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php index bfd49f637..d4d51d32b 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php @@ -61,7 +61,6 @@ class CheckoutController extends Controller auth()->setDefaultDriver($this->guard); - // $this->middleware('auth:' . $this->guard); $this->_config = request('_config'); @@ -84,6 +83,7 @@ class CheckoutController extends Controller $data = request()->all(); $data['billing']['address1'] = implode(PHP_EOL, array_filter($data['billing']['address1'])); + $data['shipping']['address1'] = implode(PHP_EOL, array_filter($data['shipping']['address1'])); if (isset($data['billing']['id']) && str_contains($data['billing']['id'], 'address_')) { @@ -97,15 +97,16 @@ class CheckoutController extends Controller } - if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates()) + if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates()) { abort(400); + } $rates = []; foreach (Shipping::getGroupedAllShippingRates() as $code => $shippingMethod) { $rates[] = [ 'carrier_title' => $shippingMethod['carrier_title'], - 'rates' => CartShippingRateResource::collection(collect($shippingMethod['rates'])) + 'rates' => CartShippingRateResource::collection(collect($shippingMethod['rates'])) ]; } @@ -114,7 +115,7 @@ class CheckoutController extends Controller return response()->json([ 'data' => [ 'rates' => $rates, - 'cart' => new CartResource(Cart::getCart()) + 'cart' => new CartResource(Cart::getCart()) ] ]); } @@ -128,15 +129,16 @@ class CheckoutController extends Controller { $shippingMethod = request()->get('shipping_method'); - if (Cart::hasError() || !$shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) + if (Cart::hasError() || !$shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) { abort(400); + } Cart::collectTotals(); return response()->json([ 'data' => [ 'methods' => Payment::getPaymentMethods(), - 'cart' => new CartResource(Cart::getCart()) + 'cart' => new CartResource(Cart::getCart()) ] ]); } @@ -150,8 +152,9 @@ class CheckoutController extends Controller { $payment = request()->get('payment'); - if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment)) + if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment)) { abort(400); + } return response()->json([ 'data' => [ @@ -167,8 +170,9 @@ class CheckoutController extends Controller */ public function saveOrder() { - if (Cart::hasError()) + if (Cart::hasError()) { abort(400); + } Cart::collectTotals(); @@ -178,7 +182,7 @@ class CheckoutController extends Controller if ($redirectUrl = Payment::getRedirectUrl($cart)) { return response()->json([ - 'success' => true, + 'success' => true, 'redirect_url' => $redirectUrl ]); } @@ -189,7 +193,7 @@ class CheckoutController extends Controller return response()->json([ 'success' => true, - 'order' => new OrderResource($order), + 'order' => new OrderResource($order), ]); } diff --git a/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php b/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php index c32816dbb..0a75d32f9 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CustomerController.php @@ -63,16 +63,16 @@ class CustomerController extends Controller { request()->validate([ 'first_name' => 'required', - 'last_name' => 'required', - 'email' => 'email|required|unique:customers,email', - 'password' => 'confirmed|min:6|required' + 'last_name' => 'required', + 'email' => 'email|required|unique:customers,email', + 'password' => 'confirmed|min:6|required' ]); $data = request()->input(); $data = array_merge($data, [ - 'password' => bcrypt($data['password']), - 'channel_id' => core()->getCurrentChannel()->id, + 'password' => bcrypt($data['password']), + 'channel_id' => core()->getCurrentChannel()->id, 'is_verified' => 1 ]); diff --git a/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php b/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php index 5121628be..3c7f3086b 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/ReviewController.php @@ -60,16 +60,16 @@ class ReviewController extends Controller $data = array_merge(request()->all(), [ 'customer_id' => $customer ? $customer->id : null, - 'name' => $customer ? $customer->name : request()->input('name'), - 'status' => 'pending', - 'product_id' => $id + 'name' => $customer ? $customer->name : request()->input('name'), + 'status' => 'pending', + 'product_id' => $id ]); $productReview = $this->reviewRepository->create($data); return response()->json([ 'message' => 'Your review submitted successfully.', - 'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id)) + 'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id)) ]); } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index 714d67efe..1d22aa332 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -101,12 +101,12 @@ class SessionController extends Controller $customer = auth($this->guard)->user(); $this->validate(request(), [ - 'first_name' => 'required', - 'last_name' => 'required', - 'gender' => 'required', + 'first_name' => 'required', + 'last_name' => 'required', + 'gender' => 'required', 'date_of_birth' => 'nullable|date|before:today', - 'email' => 'email|unique:customers,email,' . $customer->id, - 'password' => 'confirmed|min:6' + 'email' => 'email|unique:customers,email,' . $customer->id, + 'password' => 'confirmed|min:6' ]); $data = request()->all(); @@ -125,7 +125,7 @@ class SessionController extends Controller return response()->json([ 'message' => 'Your account has been created successfully.', - 'data' => new CustomerResource($this->customerRepository->find($customer->id)) + 'data' => new CustomerResource($this->customerRepository->find($customer->id)) ]); } diff --git a/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php b/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php index be3eeb84f..07cd54e41 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/WishlistController.php @@ -64,27 +64,27 @@ class WishlistController extends Controller $customer = auth()->guard($this->guard)->user(); $wishlistItem = $this->wishlistRepository->findOneWhere([ - 'channel_id' => core()->getCurrentChannel()->id, - 'product_id' => $id, + 'channel_id' => core()->getCurrentChannel()->id, + 'product_id' => $id, 'customer_id' => $customer->id ]); if (! $wishlistItem) { $wishlistItem = $this->wishlistRepository->create([ - 'channel_id' => core()->getCurrentChannel()->id, - 'product_id' => $id, + 'channel_id' => core()->getCurrentChannel()->id, + 'product_id' => $id, 'customer_id' => $customer->id ]); return response()->json([ - 'data' => new WishlistResource($wishlistItem), + 'data' => new WishlistResource($wishlistItem), 'message' => trans('customer::app.wishlist.success') ]); } else { $this->wishlistRepository->delete($wishlistItem->id); return response()->json([ - 'data' => null, + 'data' => null, 'message' => 'Item removed from wishlist successfully.' ]); } @@ -100,10 +100,11 @@ class WishlistController extends Controller { $wishlistItem = $this->wishlistRepository->findOrFail($id); - if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id) + if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id) { return response()->json([ 'message' => trans('shop::app.security-warning') ], 400); + } $result = Cart::moveToCart($wishlistItem); diff --git a/packages/Webkul/API/Http/Resources/Catalog/Attribute.php b/packages/Webkul/API/Http/Resources/Catalog/Attribute.php index 098b93f12..ca65e863e 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Attribute.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Attribute.php @@ -15,14 +15,14 @@ class Attribute extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'type' => $this->type, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'type' => $this->type, + 'name' => $this->name, 'swatch_type' => $this->swatch_type, - 'options' => AttributeOption::collection($this->options), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'options' => AttributeOption::collection($this->options), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php index 6c6743531..0bd64e3c0 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeFamily.php @@ -15,11 +15,11 @@ class AttributeFamily extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'status' => $this->status, - 'groups' => AttributeGroup::collection($this->attribute_groups), + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'status' => $this->status, + 'groups' => AttributeGroup::collection($this->attribute_groups), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php index 81fbfbf8e..cc41c9fd1 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeGroup.php @@ -15,11 +15,11 @@ class AttributeGroup extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'swatch_type' => $this->swatch_type, - 'attributes' => Attribute::collection($this->custom_attributes) + 'attributes' => Attribute::collection($this->custom_attributes) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php b/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php index ff4f21e8e..e0a9a8a5e 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php +++ b/packages/Webkul/API/Http/Resources/Catalog/AttributeOption.php @@ -15,9 +15,9 @@ class AttributeOption extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'admin_name' => $this->admin_name, - 'label' => $this->label, + 'id' => $this->id, + 'admin_name' => $this->admin_name, + 'label' => $this->label, 'swatch_value' => $this->swatch_value ]; } diff --git a/packages/Webkul/API/Http/Resources/Catalog/Category.php b/packages/Webkul/API/Http/Resources/Catalog/Category.php index 2ecb649ac..f99af8723 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Category.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Category.php @@ -15,19 +15,19 @@ class Category extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'slug' => $this->slug, - 'display_mode' => $this->display_mode, - 'description' => $this->description, - 'meta_title' => $this->meta_title, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'slug' => $this->slug, + 'display_mode' => $this->display_mode, + 'description' => $this->description, + 'meta_title' => $this->meta_title, 'meta_description' => $this->meta_description, - 'meta_keywords' => $this->meta_keywords, - 'status' => $this->status, - 'image_url' => $this->image_url, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'meta_keywords' => $this->meta_keywords, + 'status' => $this->status, + 'image_url' => $this->image_url, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/Product.php b/packages/Webkul/API/Http/Resources/Catalog/Product.php index c4a1ec895..e81a7b872 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Product.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Product.php @@ -32,23 +32,23 @@ class Product extends JsonResource $product = $this->product ? $this->product : $this; return [ - 'id' => $product->id, - 'type' => $product->type, - 'name' => $this->name, - 'url_key' => $this->url_key, - 'price' => $product->getTypeInstance()->getMinimalPrice(), - 'formated_price' => core()->currency($product->getTypeInstance()->getMinimalPrice()), - 'short_description' => $this->short_description, - 'description' => $this->description, - 'sku' => $this->sku, - 'images' => ProductImage::collection($product->images), - 'base_image' => $this->productImageHelper->getProductBaseImage($product), - 'variants' => Self::collection($this->variants), - 'in_stock' => $product->haveSufficientQuantity(1), + 'id' => $product->id, + 'type' => $product->type, + 'name' => $this->name, + 'url_key' => $this->url_key, + 'price' => $product->getTypeInstance()->getMinimalPrice(), + 'formated_price' => core()->currency($product->getTypeInstance()->getMinimalPrice()), + 'short_description' => $this->short_description, + 'description' => $this->description, + 'sku' => $this->sku, + 'images' => ProductImage::collection($product->images), + 'base_image' => $this->productImageHelper->getProductBaseImage($product), + 'variants' => Self::collection($this->variants), + 'in_stock' => $product->haveSufficientQuantity(1), $this->mergeWhen($product->getTypeInstance()->isComposite(), [ 'super_attributes' => Attribute::collection($product->super_attributes), ]), - 'special_price' => $this->when( + 'special_price' => $this->when( $product->getTypeInstance()->haveSpecialPrice(), $product->getTypeInstance()->getSpecialPrice() ), @@ -56,15 +56,15 @@ class Product extends JsonResource $product->getTypeInstance()->haveSpecialPrice(), core()->currency($product->getTypeInstance()->getSpecialPrice()) ), - 'reviews' => [ - 'total' => $total = $this->productReviewHelper->getTotalReviews($product), - 'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0, + 'reviews' => [ + 'total' => $total = $this->productReviewHelper->getTotalReviews($product), + 'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0, 'average_rating' => $total ? $this->productReviewHelper->getAverageRating($product) : 0, - 'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [], + 'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [], ], - 'is_saved' => false, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'is_saved' => false, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php b/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php index cd4e574bf..a704b8ff6 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php +++ b/packages/Webkul/API/Http/Resources/Catalog/ProductImage.php @@ -15,13 +15,13 @@ class ProductImage extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'path' => $this->path, - 'url' => $this->url, + 'id' => $this->id, + 'path' => $this->path, + 'url' => $this->url, 'original_image_url' => $this->url, - 'small_image_url' => url('cache/small/' . $this->path), - 'medium_image_url' => url('cache/medium/' . $this->path), - 'large_image_url' => url('cache/large/' . $this->path) + 'small_image_url' => url('cache/small/' . $this->path), + 'medium_image_url' => url('cache/medium/' . $this->path), + 'large_image_url' => url('cache/large/' . $this->path) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php b/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php index a2902b598..94e37820b 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php +++ b/packages/Webkul/API/Http/Resources/Catalog/ProductReview.php @@ -16,14 +16,14 @@ class ProductReview extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'title' => $this->title, - 'rating' => number_format($this->rating, 1, '.', ''), - 'comment' => $this->comment, - 'name' => $this->name, - 'status' => $this->status, - 'product' => new Product($this->product), - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'id' => $this->id, + 'title' => $this->title, + 'rating' => number_format($this->rating, 1, '.', ''), + 'comment' => $this->comment, + 'name' => $this->name, + 'status' => $this->status, + 'product' => new Product($this->product), + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Checkout/Cart.php b/packages/Webkul/API/Http/Resources/Checkout/Cart.php index 2a6401b9e..fbcd18923 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/Cart.php +++ b/packages/Webkul/API/Http/Resources/Checkout/Cart.php @@ -18,48 +18,48 @@ class Cart extends JsonResource { return [ 'id' => $this->id, - 'customer_email' => $this->customer_email, - 'customer_first_name' => $this->customer_first_name, - 'customer_last_name' => $this->customer_last_name, - 'shipping_method' => $this->shipping_method, - 'coupon_code' => $this->coupon_code, - 'is_gift' => $this->is_gift, - 'items_count' => $this->items_count, - 'items_qty' => $this->items_qty, - 'exchange_rate' => $this->exchange_rate, - 'global_currency_code' => $this->global_currency_code, - 'base_currency_code' => $this->base_currency_code, - 'channel_currency_code' => $this->channel_currency_code, - 'cart_currency_code' => $this->cart_currency_code, - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code), - 'base_grand_total' => $this->base_grand_total, + 'customer_email' => $this->customer_email, + 'customer_first_name' => $this->customer_first_name, + 'customer_last_name' => $this->customer_last_name, + 'shipping_method' => $this->shipping_method, + 'coupon_code' => $this->coupon_code, + 'is_gift' => $this->is_gift, + 'items_count' => $this->items_count, + 'items_qty' => $this->items_qty, + 'exchange_rate' => $this->exchange_rate, + 'global_currency_code' => $this->global_currency_code, + 'base_currency_code' => $this->base_currency_code, + 'channel_currency_code' => $this->channel_currency_code, + 'cart_currency_code' => $this->cart_currency_code, + 'grand_total' => $this->grand_total, + 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code), + 'base_grand_total' => $this->base_grand_total, 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code), - 'base_sub_total' => $this->base_sub_total, - 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), - 'tax_total' => $this->tax_total, - 'formated_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code), - 'base_tax_total' => $this->base_tax_total, - 'formated_base_tax_total' => core()->formatBasePrice($this->base_tax_total), - 'discount' => $this->discount, - 'formated_discount' => core()->formatPrice($this->discount, $this->cart_currency_code), - 'base_discount' => $this->base_discount, - 'formated_base_discount' => core()->formatBasePrice($this->base_discount), - 'checkout_method' => $this->checkout_method, - 'is_guest' => $this->is_guest, - 'is_active' => $this->is_active, - 'conversion_time' => $this->conversion_time, - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), - 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), - 'items' => CartItem::collection($this->items), - 'selected_shipping_rate' => new CartShippingRate($this->selected_shipping_rate), - 'payment' => new CartPayment($this->payment), - 'billing_address' => new CartAddress($this->billing_address), - 'shipping_address' => new CartAddress($this->shipping_address), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'sub_total' => $this->sub_total, + 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code), + 'base_sub_total' => $this->base_sub_total, + 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), + 'tax_total' => $this->tax_total, + 'formated_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code), + 'base_tax_total' => $this->base_tax_total, + 'formated_base_tax_total' => core()->formatBasePrice($this->base_tax_total), + 'discount' => $this->discount, + 'formated_discount' => core()->formatPrice($this->discount, $this->cart_currency_code), + 'base_discount' => $this->base_discount, + 'formated_base_discount' => core()->formatBasePrice($this->base_discount), + 'checkout_method' => $this->checkout_method, + 'is_guest' => $this->is_guest, + 'is_active' => $this->is_active, + 'conversion_time' => $this->conversion_time, + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), + 'items' => CartItem::collection($this->items), + 'selected_shipping_rate' => new CartShippingRate($this->selected_shipping_rate), + 'payment' => new CartPayment($this->payment), + 'billing_address' => new CartAddress($this->billing_address), + 'shipping_address' => new CartAddress($this->shipping_address), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php b/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php index 1bed8697c..0ff7f7987 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartAddress.php @@ -16,19 +16,19 @@ class CartAddress extends JsonResource { return [ 'id' => $this->id, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'name' => $this->name, - 'email' => $this->email, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'name' => $this->name, + 'email' => $this->email, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartItem.php b/packages/Webkul/API/Http/Resources/Checkout/CartItem.php index 37c36684e..9f3418734 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartItem.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartItem.php @@ -16,42 +16,42 @@ class CartItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'quantity' => $this->quantity, - 'sku' => $this->sku, - 'type' => $this->type, - 'name' => $this->name, - 'coupon_code' => $this->coupon_code, - 'weight' => $this->weight, - 'total_weight' => $this->total_weight, - 'base_total_weight' => $this->base_total_weight, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'custom_price' => $this->custom_price, - 'formated_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'tax_percent' => $this->tax_percent, - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code), - 'base_discount_amount' => $this->base_discount_amount, + 'id' => $this->id, + 'quantity' => $this->quantity, + 'sku' => $this->sku, + 'type' => $this->type, + 'name' => $this->name, + 'coupon_code' => $this->coupon_code, + 'weight' => $this->weight, + 'total_weight' => $this->total_weight, + 'base_total_weight' => $this->base_total_weight, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'custom_price' => $this->custom_price, + 'formated_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'tax_percent' => $this->tax_percent, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'discount_percent' => $this->discount_percent, + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code), + 'base_discount_amount' => $this->base_discount_amount, 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'product' => $this->when($this->product_id, new ProductResource($this->product)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'product' => $this->when($this->product_id, new ProductResource($this->product)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php b/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php index 8ab0c28ac..530144708 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartPayment.php @@ -15,11 +15,11 @@ class CartPayment extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'method' => $this->method, + 'id' => $this->id, + 'method' => $this->method, 'method_title' => core()->getConfigData('sales.paymentmethods.' . $this->method . '.title'), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php b/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php index 370697be5..bb0204672 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php +++ b/packages/Webkul/API/Http/Resources/Checkout/CartShippingRate.php @@ -18,18 +18,18 @@ class CartShippingRate extends JsonResource $cart = Cart::getCart(); return [ - 'id' => $this->id, - 'carrier' => $this->carrier, - 'carrier_title' => $this->carrier_title, - 'method' => $this->method, - 'method_title' => $this->method_title, - 'method_description' => $this->method_description, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $cart->cart_currency_code), - 'base_price' => $this->base_price, + 'id' => $this->id, + 'carrier' => $this->carrier, + 'carrier_title' => $this->carrier_title, + 'method' => $this->method, + 'method_title' => $this->method_title, + 'method_description' => $this->method_description, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $cart->cart_currency_code), + 'base_price' => $this->base_price, 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Core/Channel.php b/packages/Webkul/API/Http/Resources/Core/Channel.php index e85085ce0..4298e3b44 100644 --- a/packages/Webkul/API/Http/Resources/Core/Channel.php +++ b/packages/Webkul/API/Http/Resources/Core/Channel.php @@ -18,25 +18,25 @@ class Channel extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'description' => $this->description, - 'timezone' => $this->timezone, - 'theme' => $this->theme, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'description' => $this->description, + 'timezone' => $this->timezone, + 'theme' => $this->theme, 'home_page_content' => $this->home_page_content, - 'footer_content' => $this->footer_content, - 'hostname' => $this->hostname, - 'logo' => $this->logo, - 'logo_url' => $this->logo_url, - 'favicon' => $this->favicon, - 'favicon_url' => $this->favicon_url, - 'default_locale' => $this->when($this->default_locale_id, new LocaleResource($this->default_locale)), - 'base_currency' => $this->when($this->default_currency_id, new CurrencyResource($this->default_currency)), - 'root_category_id' => $this->root_category_id, - 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'footer_content' => $this->footer_content, + 'hostname' => $this->hostname, + 'logo' => $this->logo, + 'logo_url' => $this->logo_url, + 'favicon' => $this->favicon, + 'favicon_url' => $this->favicon_url, + 'default_locale' => $this->when($this->default_locale_id, new LocaleResource($this->default_locale)), + 'base_currency' => $this->when($this->default_currency_id, new CurrencyResource($this->default_currency)), + 'root_category_id' => $this->root_category_id, + 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Core/Country.php b/packages/Webkul/API/Http/Resources/Core/Country.php index 46f13f0c1..92c18cb17 100644 --- a/packages/Webkul/API/Http/Resources/Core/Country.php +++ b/packages/Webkul/API/Http/Resources/Core/Country.php @@ -15,7 +15,7 @@ class Country extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, + 'id' => $this->id, 'code' => $this->code, 'name' => $this->name ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Currency.php b/packages/Webkul/API/Http/Resources/Core/Currency.php index 5ef066daa..dd8169ec6 100644 --- a/packages/Webkul/API/Http/Resources/Core/Currency.php +++ b/packages/Webkul/API/Http/Resources/Core/Currency.php @@ -15,9 +15,9 @@ class Currency extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Locale.php b/packages/Webkul/API/Http/Resources/Core/Locale.php index 21e5e4399..9cdd7c8e8 100644 --- a/packages/Webkul/API/Http/Resources/Core/Locale.php +++ b/packages/Webkul/API/Http/Resources/Core/Locale.php @@ -15,9 +15,9 @@ class Locale extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Core/Slider.php b/packages/Webkul/API/Http/Resources/Core/Slider.php index fada15f9b..76bf0fc37 100644 --- a/packages/Webkul/API/Http/Resources/Core/Slider.php +++ b/packages/Webkul/API/Http/Resources/Core/Slider.php @@ -15,10 +15,10 @@ class Slider extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'title' => $this->title, + 'id' => $this->id, + 'title' => $this->title, 'image_url' => $this->image_url, - 'content' => $this->content + 'content' => $this->content ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/Customer.php b/packages/Webkul/API/Http/Resources/Customer/Customer.php index 7e7a98485..31f1a3b5f 100644 --- a/packages/Webkul/API/Http/Resources/Customer/Customer.php +++ b/packages/Webkul/API/Http/Resources/Customer/Customer.php @@ -15,18 +15,18 @@ class Customer extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'email' => $this->email, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'name' => $this->name, - 'gender' => $this->gender, + 'id' => $this->id, + 'email' => $this->email, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'name' => $this->name, + 'gender' => $this->gender, 'date_of_birth' => $this->date_of_birth, - 'phone' => $this->phone, - 'status' => $this->status, - 'group' => $this->when($this->customer_group_id, new CustomerGroup($this->group)), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'phone' => $this->phone, + 'status' => $this->status, + 'group' => $this->when($this->customer_group_id, new CustomerGroup($this->group)), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php b/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php index 3b792e195..111cdb31c 100644 --- a/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php +++ b/packages/Webkul/API/Http/Resources/Customer/CustomerAddress.php @@ -15,16 +15,16 @@ class CustomerAddress extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'id' => $this->id, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php b/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php index 80765deb2..fdda10af0 100644 --- a/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php +++ b/packages/Webkul/API/Http/Resources/Customer/CustomerGroup.php @@ -15,8 +15,8 @@ class CustomerGroup extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, + 'id' => $this->id, + 'name' => $this->name, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Customer/Wishlist.php b/packages/Webkul/API/Http/Resources/Customer/Wishlist.php index 75b04de44..809f75da3 100644 --- a/packages/Webkul/API/Http/Resources/Customer/Wishlist.php +++ b/packages/Webkul/API/Http/Resources/Customer/Wishlist.php @@ -16,8 +16,8 @@ class Wishlist extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'product' => new ProductResource($this->product), + 'id' => $this->id, + 'product' => new ProductResource($this->product), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; diff --git a/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php b/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php index fab464195..dcb8a4b23 100644 --- a/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php +++ b/packages/Webkul/API/Http/Resources/Inventory/InventorySource.php @@ -15,25 +15,25 @@ class InventorySource extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'code' => $this->code, - 'name' => $this->name, - 'description' => $this->description, - 'contact_name' => $this->contact_name, - 'contact_email' => $this->contact_email, + 'id' => $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'description' => $this->description, + 'contact_name' => $this->contact_name, + 'contact_email' => $this->contact_email, 'contact_number' => $this->contact_number, - 'contact_fax' => $this->contact_fax, - 'country' => $this->country, - 'state' => $this->state, - 'city' => $this->city, - 'street' => $this->street, - 'postcode' => $this->postcode, - 'priority' => $this->priority, - 'latitude' => $this->latitude, - 'longitude' => $this->collongitudeongitudeuntry, - 'status' => $this->status, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'contact_fax' => $this->contact_fax, + 'country' => $this->country, + 'state' => $this->state, + 'city' => $this->city, + 'street' => $this->street, + 'postcode' => $this->postcode, + 'priority' => $this->priority, + 'latitude' => $this->latitude, + 'longitude' => $this->collongitudeongitudeuntry, + 'status' => $this->status, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/Invoice.php b/packages/Webkul/API/Http/Resources/Sales/Invoice.php index 239056f25..8c5a8dcc2 100644 --- a/packages/Webkul/API/Http/Resources/Sales/Invoice.php +++ b/packages/Webkul/API/Http/Resources/Sales/Invoice.php @@ -15,37 +15,37 @@ class Invoice extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'state' => $this->state, - 'email_sent' => $this->email_sent, - 'total_qty' => $this->total_qty, - 'base_currency_code' => $this->base_currency_code, - 'channel_currency_code' => $this->channel_currency_code, - 'order_currency_code' => $this->order_currency_code, - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), - 'base_sub_total' => $this->base_sub_total, - 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), - 'base_grand_total' => $this->base_grand_total, - 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), - 'shipping_amount' => $this->shipping_amount, - 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), - 'base_shipping_amount' => $this->base_shipping_amount, + 'id' => $this->id, + 'state' => $this->state, + 'email_sent' => $this->email_sent, + 'total_qty' => $this->total_qty, + 'base_currency_code' => $this->base_currency_code, + 'channel_currency_code' => $this->channel_currency_code, + 'order_currency_code' => $this->order_currency_code, + 'sub_total' => $this->sub_total, + 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), + 'base_sub_total' => $this->base_sub_total, + 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), + 'grand_total' => $this->grand_total, + 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), + 'base_grand_total' => $this->base_grand_total, + 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), + 'shipping_amount' => $this->shipping_amount, + 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), + 'base_shipping_amount' => $this->base_shipping_amount, 'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), - 'base_discount_amount' => $this->base_discount_amount, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), + 'base_discount_amount' => $this->base_discount_amount, 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'order_address' => new OrderAddress($this->address), - 'transaction_id' => $this->transaction_id, - 'items' => InvoiceItem::collection($this->items), - 'created_at' => $this->created_at + 'order_address' => new OrderAddress($this->address), + 'transaction_id' => $this->transaction_id, + 'items' => InvoiceItem::collection($this->items), + 'created_at' => $this->created_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php b/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php index c5fd3d09b..bfdd0d7d3 100644 --- a/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/InvoiceItem.php @@ -15,34 +15,34 @@ class InvoiceItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, - // 'product' => $this->when($this->product, new ProductResource($this->product)), - 'description' => $this->description, - 'sku' => $this->sku, - 'description' => $this->description, - 'qty' => $this->qty, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->invoice->order_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->invoice->order_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->invoice->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'grand_total' => $this->total + $this->tax_amount, - 'formated_grand_total' => core()->formatPrice($this->total + $this->tax_amount, $this->invoice->order_currency_code), - 'base_grand_total' => $this->base_total + $this->base_tax_amount, + 'id' => $this->id, + 'name' => $this->name, + // 'product' => $this->when($this->product, new ProductResource($this->product)), + 'description' => $this->description, + 'sku' => $this->sku, + 'description' => $this->description, + 'qty' => $this->qty, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->invoice->order_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->invoice->order_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->invoice->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'grand_total' => $this->total + $this->tax_amount, + 'formated_grand_total' => core()->formatPrice($this->total + $this->tax_amount, $this->invoice->order_currency_code), + 'base_grand_total' => $this->base_total + $this->base_tax_amount, 'formated_base_grand_total' => core()->formatBasePrice($this->base_total + $this->base_tax_amount), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'children' => Self::collection($this->children) + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'children' => Self::collection($this->children) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/Order.php b/packages/Webkul/API/Http/Resources/Sales/Order.php index 5f59e561c..325fc5873 100644 --- a/packages/Webkul/API/Http/Resources/Sales/Order.php +++ b/packages/Webkul/API/Http/Resources/Sales/Order.php @@ -17,93 +17,93 @@ class Order extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'status' => $this->status, - 'status_label' => $this->status_label, - 'channel_name' => $this->channel_name, - 'is_guest' => $this->is_guest, - 'customer_email' => $this->customer_email, - '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, - 'is_gift' => $this->is_gift, - 'total_item_count' => $this->total_item_count, - 'total_qty_ordered' => $this->total_qty_ordered, - 'base_currency_code' => $this->base_currency_code, - 'channel_currency_code' => $this->channel_currency_code, - 'order_currency_code' => $this->order_currency_code, - 'grand_total' => $this->grand_total, - 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), - 'base_grand_total' => $this->base_grand_total, - 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), - 'grand_total_invoiced' => $this->grand_total_invoiced, - 'formated_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code), - 'base_grand_total_invoiced' => $this->base_grand_total_invoiced, + 'id' => $this->id, + 'status' => $this->status, + 'status_label' => $this->status_label, + 'channel_name' => $this->channel_name, + 'is_guest' => $this->is_guest, + 'customer_email' => $this->customer_email, + '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, + 'is_gift' => $this->is_gift, + 'total_item_count' => $this->total_item_count, + 'total_qty_ordered' => $this->total_qty_ordered, + 'base_currency_code' => $this->base_currency_code, + 'channel_currency_code' => $this->channel_currency_code, + 'order_currency_code' => $this->order_currency_code, + 'grand_total' => $this->grand_total, + 'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), + 'base_grand_total' => $this->base_grand_total, + 'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total), + 'grand_total_invoiced' => $this->grand_total_invoiced, + 'formated_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code), + 'base_grand_total_invoiced' => $this->base_grand_total_invoiced, 'formated_base_grand_total_invoiced' => core()->formatBasePrice($this->base_grand_total_invoiced), - 'grand_total_refunded' => $this->grand_total_refunded, - 'formated_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code), - 'base_grand_total_refunded' => $this->base_grand_total_refunded, + 'grand_total_refunded' => $this->grand_total_refunded, + 'formated_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code), + 'base_grand_total_refunded' => $this->base_grand_total_refunded, 'formated_base_grand_total_refunded' => core()->formatBasePrice($this->base_grand_total_refunded), - 'sub_total' => $this->sub_total, - 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), - 'base_sub_total' => $this->base_sub_total, - 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), - 'sub_total_invoiced' => $this->sub_total_invoiced, - 'formated_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code), - 'base_sub_total_invoiced' => $this->base_sub_total_invoiced, - 'formated_base_sub_total_invoiced' => core()->formatBasePrice($this->base_sub_total_invoiced), - 'sub_total_refunded' => $this->sub_total_refunded, - 'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code), - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), - 'base_discount_amount' => $this->base_discount_amount, - 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'discount_invoiced' => $this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order_currency_code), - 'base_discount_invoiced' => $this->base_discount_invoiced, - 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), - 'discount_refunded' => $this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order_currency_code), - 'base_discount_refunded' => $this->base_discount_refunded, - 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'tax_amount_invoiced' => $this->tax_amount_invoiced, - 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order_currency_code), - 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, - 'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced), - 'tax_amount_refunded' => $this->tax_amount_refunded, - 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order_currency_code), - 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, - 'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded), - 'shipping_amount' => $this->shipping_amount, - 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), - 'base_shipping_amount' => $this->base_shipping_amount, - 'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount), - 'shipping_invoiced' => $this->shipping_invoiced, - 'formated_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code), - 'base_shipping_invoiced' => $this->base_shipping_invoiced, - 'formated_base_shipping_invoiced' => core()->formatBasePrice($this->base_shipping_invoiced), - 'shipping_refunded' => $this->shipping_refunded, - 'formated_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code), - 'base_shipping_refunded' => $this->base_shipping_refunded, - 'formated_base_shipping_refunded' => core()->formatBasePrice($this->base_shipping_refunded), - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), - 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), - 'shipping_address' => new OrderAddress($this->shipping_address), - 'billing_address' => new OrderAddress($this->billing_address), - 'updated_at' => $this->updated_at, - 'items' => OrderItem::collection($this->items), - 'invoices' => Invoice::collection($this->invoices), - 'shipments' => Shipment::collection($this->shipments), - 'created_at' => $this->created_at + 'sub_total' => $this->sub_total, + 'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), + 'base_sub_total' => $this->base_sub_total, + 'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total), + 'sub_total_invoiced' => $this->sub_total_invoiced, + 'formated_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code), + 'base_sub_total_invoiced' => $this->base_sub_total_invoiced, + 'formated_base_sub_total_invoiced' => core()->formatBasePrice($this->base_sub_total_invoiced), + 'sub_total_refunded' => $this->sub_total_refunded, + 'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code), + 'discount_percent' => $this->discount_percent, + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code), + 'base_discount_amount' => $this->base_discount_amount, + 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), + 'discount_invoiced' => $this->discount_invoiced, + 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order_currency_code), + 'base_discount_invoiced' => $this->base_discount_invoiced, + 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), + 'discount_refunded' => $this->discount_refunded, + 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order_currency_code), + 'base_discount_refunded' => $this->base_discount_refunded, + 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'tax_amount_invoiced' => $this->tax_amount_invoiced, + 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order_currency_code), + 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, + 'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced), + 'tax_amount_refunded' => $this->tax_amount_refunded, + 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order_currency_code), + 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, + 'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded), + 'shipping_amount' => $this->shipping_amount, + 'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), + 'base_shipping_amount' => $this->base_shipping_amount, + 'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount), + 'shipping_invoiced' => $this->shipping_invoiced, + 'formated_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code), + 'base_shipping_invoiced' => $this->base_shipping_invoiced, + 'formated_base_shipping_invoiced' => core()->formatBasePrice($this->base_shipping_invoiced), + 'shipping_refunded' => $this->shipping_refunded, + 'formated_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code), + 'base_shipping_refunded' => $this->base_shipping_refunded, + 'formated_base_shipping_refunded' => core()->formatBasePrice($this->base_shipping_refunded), + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)), + 'shipping_address' => new OrderAddress($this->shipping_address), + 'billing_address' => new OrderAddress($this->billing_address), + 'updated_at' => $this->updated_at, + 'items' => OrderItem::collection($this->items), + 'invoices' => Invoice::collection($this->invoices), + 'shipments' => Shipment::collection($this->shipments), + 'created_at' => $this->created_at ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php b/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php index bb18a5a6a..78e3db345 100644 --- a/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php +++ b/packages/Webkul/API/Http/Resources/Sales/OrderAddress.php @@ -15,19 +15,19 @@ class OrderAddress extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'email' => $this->email, - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'address1' => explode(PHP_EOL, $this->address1), - 'country' => $this->country, + 'id' => $this->id, + 'email' => $this->email, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'address1' => explode(PHP_EOL, $this->address1), + 'country' => $this->country, 'country_name' => core()->country_name($this->country), - 'state' => $this->state, - 'city' => $this->city, - 'postcode' => $this->postcode, - 'phone' => $this->phone, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'state' => $this->state, + 'city' => $this->city, + 'postcode' => $this->postcode, + 'phone' => $this->phone, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/OrderItem.php b/packages/Webkul/API/Http/Resources/Sales/OrderItem.php index a6420b480..f7eb3b8cb 100644 --- a/packages/Webkul/API/Http/Resources/Sales/OrderItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/OrderItem.php @@ -16,70 +16,70 @@ class OrderItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'sku' => $this->sku, - 'type' => $this->type, - 'name' => $this->name, - 'product' => $this->when($this->product, new ProductResource($this->product)), - 'coupon_code' => $this->coupon_code, - 'weight' => $this->weight, - 'total_weight' => $this->total_weight, - 'qty_ordered' => $this->qty_ordered, - 'qty_canceled' => $this->qty_canceled, - 'qty_invoiced' => $this->qty_invoiced, - 'qty_shipped' => $this->qty_shipped, - 'qty_refunded' => $this->qty_refunded, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->order->order_currency_code), - 'base_price' => $this->base_price, - 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->order->order_currency_code), - 'base_total' => $this->base_total, - 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'total_invoiced' => $this->total_invoiced, - 'formated_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), - 'base_total_invoiced' => $this->base_total_invoiced, - 'formated_base_total_invoiced' => core()->formatBasePrice($this->base_total_invoiced), - 'amount_refunded' => $this->amount_refunded, - 'formated_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), - 'base_amount_refunded' => $this->base_amount_refunded, - 'formated_base_amount_refunded' => core()->formatBasePrice($this->base_amount_refunded), - 'discount_percent' => $this->discount_percent, - 'discount_amount' => $this->discount_amount, - 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), - 'base_discount_amount' => $this->base_discount_amount, - 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), - 'discount_invoiced' => $this->discount_invoiced, - 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), - 'base_discount_invoiced' => $this->base_discount_invoiced, - 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), - 'discount_refunded' => $this->discount_refunded, - 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), - 'base_discount_refunded' => $this->base_discount_refunded, - 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), - 'tax_percent' => $this->tax_percent, - 'tax_amount' => $this->tax_amount, - 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order->order_currency_code), - 'base_tax_amount' => $this->base_tax_amount, - 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), - 'tax_amount_invoiced' => $this->tax_amount_invoiced, - 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order->order_currency_code), - 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, + 'id' => $this->id, + 'sku' => $this->sku, + 'type' => $this->type, + 'name' => $this->name, + 'product' => $this->when($this->product, new ProductResource($this->product)), + 'coupon_code' => $this->coupon_code, + 'weight' => $this->weight, + 'total_weight' => $this->total_weight, + 'qty_ordered' => $this->qty_ordered, + 'qty_canceled' => $this->qty_canceled, + 'qty_invoiced' => $this->qty_invoiced, + 'qty_shipped' => $this->qty_shipped, + 'qty_refunded' => $this->qty_refunded, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->order->order_currency_code), + 'base_price' => $this->base_price, + 'formated_base_price' => core()->formatBasePrice($this->base_price), + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->order->order_currency_code), + 'base_total' => $this->base_total, + 'formated_base_total' => core()->formatBasePrice($this->base_total), + 'total_invoiced' => $this->total_invoiced, + 'formated_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), + 'base_total_invoiced' => $this->base_total_invoiced, + 'formated_base_total_invoiced' => core()->formatBasePrice($this->base_total_invoiced), + 'amount_refunded' => $this->amount_refunded, + 'formated_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), + 'base_amount_refunded' => $this->base_amount_refunded, + 'formated_base_amount_refunded' => core()->formatBasePrice($this->base_amount_refunded), + 'discount_percent' => $this->discount_percent, + 'discount_amount' => $this->discount_amount, + 'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), + 'base_discount_amount' => $this->base_discount_amount, + 'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount), + 'discount_invoiced' => $this->discount_invoiced, + 'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), + 'base_discount_invoiced' => $this->base_discount_invoiced, + 'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced), + 'discount_refunded' => $this->discount_refunded, + 'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), + 'base_discount_refunded' => $this->base_discount_refunded, + 'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded), + 'tax_percent' => $this->tax_percent, + 'tax_amount' => $this->tax_amount, + 'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order->order_currency_code), + 'base_tax_amount' => $this->base_tax_amount, + 'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount), + 'tax_amount_invoiced' => $this->tax_amount_invoiced, + 'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order->order_currency_code), + 'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced, 'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced), - 'tax_amount_refunded' => $this->tax_amount_refunded, - 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order->order_currency_code), - 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, + 'tax_amount_refunded' => $this->tax_amount_refunded, + 'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order->order_currency_code), + 'base_tax_amount_refunded' => $this->base_tax_amount_refunded, 'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded), - 'grant_total' => $this->total + $this->tax_amount, - 'formated_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), - 'base_grant_total' => $this->base_total + $this->base_tax_amount, - 'formated_base_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true), - 'child' => new self($this->child), - 'children' => Self::collection($this->children) + 'grant_total' => $this->total + $this->tax_amount, + 'formated_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), + 'base_grant_total' => $this->base_total + $this->base_tax_amount, + 'formated_base_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code), + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true), + 'child' => new self($this->child), + 'children' => Self::collection($this->children) ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/Shipment.php b/packages/Webkul/API/Http/Resources/Sales/Shipment.php index 6e9df69b1..74aade44a 100644 --- a/packages/Webkul/API/Http/Resources/Sales/Shipment.php +++ b/packages/Webkul/API/Http/Resources/Sales/Shipment.php @@ -17,17 +17,17 @@ class Shipment extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'status' => $this->status, - 'total_qty' => $this->total_qty, - 'total_weight' => $this->total_weight, - 'carrier_code' => $this->carrier_code, - 'carrier_title' => $this->carrier_title, - 'track_number' => $this->track_number, - 'email_sent' => $this->email_sent, - 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), + 'id' => $this->id, + 'status' => $this->status, + 'total_qty' => $this->total_qty, + 'total_weight' => $this->total_weight, + 'carrier_code' => $this->carrier_code, + 'carrier_title' => $this->carrier_title, + 'track_number' => $this->track_number, + 'email_sent' => $this->email_sent, + 'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)), 'inventory_source' => $this->when($this->inventory_source_id, new InventorySourceResource($this->inventory_source)), - 'items' => ShipmentItem::collection($this->items), + 'items' => ShipmentItem::collection($this->items), ]; } } \ No newline at end of file diff --git a/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php b/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php index 678af6d6f..f631266de 100644 --- a/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php +++ b/packages/Webkul/API/Http/Resources/Sales/ShipmentItem.php @@ -15,23 +15,23 @@ class ShipmentItem extends JsonResource public function toArray($request) { return [ - 'id' => $this->id, - 'name' => $this->name, - 'description' => $this->description, - 'sku' => $this->sku, - 'qty' => $this->qty, - 'weight' => $this->weight, - 'price' => $this->price, - 'formated_price' => core()->formatPrice($this->price, $this->shipment->order->order_currency_code), - 'base_price' => $this->base_price, + 'id' => $this->id, + 'name' => $this->name, + 'description' => $this->description, + 'sku' => $this->sku, + 'qty' => $this->qty, + 'weight' => $this->weight, + 'price' => $this->price, + 'formated_price' => core()->formatPrice($this->price, $this->shipment->order->order_currency_code), + 'base_price' => $this->base_price, 'formated_base_price' => core()->formatBasePrice($this->base_price), - 'total' => $this->total, - 'formated_total' => core()->formatPrice($this->total, $this->shipment->order->order_currency_code), - 'base_total' => $this->base_total, + 'total' => $this->total, + 'formated_total' => core()->formatPrice($this->total, $this->shipment->order->order_currency_code), + 'base_total' => $this->base_total, 'formated_base_total' => core()->formatBasePrice($this->base_total), - 'additional' => is_array($this->resource->additional) - ? $this->resource->additional - : json_decode($this->resource->additional, true) + 'additional' => is_array($this->resource->additional) + ? $this->resource->additional + : json_decode($this->resource->additional, true) ]; } } \ No newline at end of file