Файловый менеджер - Редактировать - /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Http/Resources/Admin/OrderInfoEditResource.php
Назад
<?php namespace App\Http\Resources\Admin; use App\Models\Coupon; use App\Models\Status; use App\Models\User; use Carbon\Carbon; use Illuminate\Http\Resources\Json\JsonResource; class OrderInfoEditResource extends JsonResource { public function toArray($request) { $statuses = $order_items = []; $user = $this->user; $coupon_code = Coupon::where('id', $this->coupon_id)->first(); $existing_order_statuses = $this->statuses; foreach (Status::all() as $status) { $st = $existing_order_statuses->where('id', $status->id)->first(); if ($st) { $status_user = User::find($st->pivot->user_id); $checked = true; $notes = $st->pivot->notes ?: 'N/A'; $updated_by = $status_user->name ?? 'N/A'; $updated_at = $st->pivot->updated_at ? Carbon::make($st->pivot->updated_at)->diffForHumans() : 'N/A'; } else { $checked = false; $notes = 'N/A'; $updated_by = 'N/A'; $updated_at = 'N/A'; } $statuses[] = [ 'id' => $status->id, 'name' => $status->name, 'color' => $status->color, 'notes' => $notes, 'updated_by' => $updated_by, 'updated_at' => $updated_at, 'is_selected' => $checked, ]; } foreach ($this->items as $item) { $variations = $customization_array = []; foreach ($item->orderItemVariations as $variation) { $variations[] = [ 'id' => $variation->variation?->id, 'type' => $variation->variation?->type, 'value' => $variation->variation?->value, ]; } foreach ($item->orderItemCustomizations as $customization) { $customization_array['url'][] = $customization->mediaUrl; } $order_items[] = [ 'product_id' => $item->product?->id, 'item_id' => $item->id, 'price_id' => $item->price_id, 'product_sku' => $item->product?->sku, 'product_price_sku' => $item->productPrice?->supplier_prod_number, 'product_slug' => $item->product?->slug, 'product_image' => $item->product?->featured_image?->preview, 'product' => $item->product?->name, 'product_vendor' => $item->product?->vendor?->name, 'quantity' => $item->quantity, 'price' => $item->price, 'customization' => $customization_array, 'product_customization' => json_decode($item->customization ?? "[]"), 'sketch_file' => $item->productPrice?->product_sketch_media, 'template' => $item->template_media ?: 'N/A', 'image' => $item->imageUrl ?: 'N/A', 'variations' => $variations, 'notes' => $item->notes, 'approved_consent' => $item->approved_consent ? 'Yes' : 'No', ]; } return [ 'id' => $this->id, 'order_type' => $this->order_type, 'rush_order' => $this->rush_order, 'rush_order_fee' => ($this->rush_order_fee ?? 0) . '%', 'order_number' => $this->order_number, 'payment_status' => $this->payment_status, 'payment_date' => $this->formated_payment_date, 'payment_type' => $this->payment_type, 'payment_mode' => $this->payment_mode, 'cheque_number' => $this->cheque_number, 'purchase_order_number' => $this->purchase_order_number ?? 'N/A', 'purchase_order_copy' => $this->purchase_order_copy_url ?? 'N/A', 'delivery_date' => $this->delivery_date?->format('Y-m-d'), 'event_date' => $this->event_date?->format('Y-m-d'), 'date_scheduled' => $this->date_scheduled?->format('Y-m-d'), 'date_pick_or_ship_by' => $this->date_pick_or_ship_by?->format('Y-m-d'), 'delivery_type' => $this->delivery_type, 'tracking_number' => $this->tracking_number, 'pickup_by' => $this->pickup_by, 'pickup_location_id' => $this->pickup_location_id, 'billing_address_id' => $this->billing_address_id, 'shipping_address_id' => $this->shipping_address_id, 'is_residential' => $this->is_residential, 'description' => $this->description, 'waive_off_sales_tax' => $this->waive_off_sales_tax, 'waive_off_sales_tax_reason' => $this->waive_off_sales_tax_reason, 'career_code' => $this->career_code, 'service_code' => $this->service_code, 'package_type_code' => $this->package_type_code, 'shipping_total_amount' => $this->shipping_charges, 'resale_number' => $this->resale_number, 'coupon_code' => $coupon_code?->code, 'current_status' => [ 'id' => $this->current_status_id, 'status' => $this->current_status?->name, ], 'products' => $order_items, 'user' => $user ? [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, ] : [], 'available_statuses' => $statuses, 'relational_shipping_address' => $this->shipping_address ? [ 'company_name' => $this->shipping_address->company_name, 'primary_contact_name' => $this->shipping_address->primary_contact_name, 'primary_contact_email' => $this->shipping_address->primary_contact_email, 'secondary_contact_name' => $this->shipping_address->secondary_contact_name, 'secondary_contact_email' => $this->shipping_address->secondary_contact_email, 'address_line_1' => $this->shipping_address->address_line_1, 'address_line_2' => $this->shipping_address->address_line_2, 'city' => $this->shipping_address->city, 'state' => $this->shipping_address->state->name, 'zipcode' => $this->shipping_address->zipcode, 'phone_number' => $this->shipping_address->phone_number, ] : [], 'relational_billing_address' => $this->billing_address ? [ 'company_name' => $this->billing_address->company_name, 'primary_contact_name' => $this->billing_address->primary_contact_name, 'primary_contact_email' => $this->billing_address->primary_contact_email, 'secondary_contact_name' => $this->billing_address->secondary_contact_name, 'secondary_contact_email' => $this->billing_address->secondary_contact_email, 'address_line_1' => $this->billing_address->address_line_1, 'address_line_2' => $this->billing_address->address_line_2, 'city' => $this->billing_address->city, 'state' => $this->billing_address->state->name, 'zipcode' => $this->billing_address->zipcode, 'phone_number' => $this->billing_address->phone_number, ] : [], ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка