Файловый менеджер - Редактировать - /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Http/Resources/Admin/WorkOrder.php
Назад
<?php namespace App\Http\Resources\Admin; use App\Models\SiteSetting; use Illuminate\Http\Resources\Json\JsonResource; class WorkOrder extends JsonResource { public function toArray($request) { $order_items = []; $user = $this->user; foreach ($this->items as $item) { $variations = $svgs = []; foreach ($item->orderItemVariations as $variation){ $variations[] = [ 'id' => $variation->variation?->id, 'type' => $variation->variation?->type, 'value' => $variation->variation?->value, ]; } foreach ($item->customizationSvg as $svg){ $svgs[] = [ 'order_id' => $svg->order_id, 'order_item_id' => $svg->order_item_id, 'customization_index' => $svg->customization_index, 'url' => $svg->customization_svg_url, ]; } $order_items[] = [ 'product_id' => $item->product?->id, 'product_description' => $item->product?->description, 'product_sku' => $item->productPrice?->supplier_prod_number, 'product_image' => $item->product?->featured_image?->preview, 'product' => $item->product?->name, 'quantity' => $item->quantity, '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, 'customization_svgs' => $svgs, 'template_pages' => getTemplatePngs($this->user_id, $item->id), ]; } //Business Information $site_email = SiteSetting::where('key', 'Site Email')->first(); $site_phone = SiteSetting::where('key', 'Site Phone')->first(); $location_1 = SiteSetting::where('key', 'Location')->first(); $location_2 = SiteSetting::where('key', 'Location 2')->first(); $business_information = [ 'site_email' => $site_email->value ?? "NA", 'site_phone' => $site_phone->value ?? "NA", 'location_1' => $location_1->value ?? "NA", 'location_2' => $location_2->value ?? "NA", ]; return [ 'invoice' => $this->invoice ? [ "invoice_number" => $this->invoice->invoice_number, "invoice_date" => $this->invoice->created_at->format('m/d/Y') ] : null, 'assigned_to' => $this->assigned_to?->name, 'rush_order' => $this->rush_order, 'rush_order_fee' => ($this->rush_order_fee ?? 0).'%', 'order_number' => $this->order_number, 'tracking_number' => $this->tracking_number, 'payment_status' => $this->payment_status, 'payment_date' => $this->formated_payment_date, 'payment_type' => $this->payment_type, 'cc_details' => $this->payment ? [ 'last_four' => $this->payment->last_four, 'card_type' => $this->payment->account_type, 'payment_date' => $this->payment->created_at->format('m/d/Y'), 'transaction_id' => $this->payment->transaction_id ] : [], 'cheque_number' => $this->cheque_number, 'purchase_order_number' => $this->purchase_order_number ?? 'N/A', 'purchase_order_copy' => $this->purchase_order_copy_url ?? 'N/A', 'date_pick_or_ship_by' => $this->date_pick_or_ship_by?->format('m/d/Y'), 'event_date' => $this->event_date?->format('m/d/Y'), 'created_at' => $this->created_at?->format('m/d/Y H:i:s'), 'delivery_type' => $this->delivery_type, 'pickup_location_title' => $this->pickLocation?->title, 'pickup_location_address' => $this->pickLocation?->address, 'billing_details' => [ 'billing_company_name' => $this->billing_company_name, 'billing_primary_contact_name' => $this->billing_primary_contact_name, 'billing_primary_contact_email' => $this->billing_primary_contact_email, 'billing_secondary_contact_name' => $this->billing_secondary_contact_name, 'billing_secondary_contact_email' => $this->billing_secondary_contact_email, 'billing_address_line_1' => $this->billing_address_line_1, 'billing_address_line_2' => $this->billing_address_line_2, 'billing_city' => $this->billing_city, 'billing_state' => $this->billing_state, 'billing_zipcode' => $this->billing_zipcode, 'billing_phone_number' => $this->billing_phone_number, ], 'shipping_details' => $this->delivery_type == 'Shipping' ? [ 'career_code' => str_replace('_', ' ', $this->career_code), 'service_code' => str_replace('_', ' ', $this->service_code), 'package_type_code' => str_replace('_', ' ', $this->package_type_code), 'shipping_company_name' => $this->shipping_company_name, 'shipping_primary_contact_name' => $this->shipping_primary_contact_name, 'shipping_primary_contact_email' => $this->shipping_primary_contact_email, 'shipping_secondary_contact_name' => $this->shipping_secondary_contact_name, 'shipping_secondary_contact_email' => $this->shipping_secondary_contact_email, 'shipping_address_line_1' => $this->shipping_address_line_1, 'shipping_address_line_2' => $this->shipping_address_line_2, 'shipping_city' => $this->shipping_city, 'shipping_state' => $this->shipping_state, 'shipping_zipcode' => $this->shipping_zipcode, ] : [], 'description' => $this->description, 'current_status' => $this->current_status?->name, 'stock_location' => $this->stockLocation ? $this->stockLocation->location : null, 'business_information' => $business_information, 'products' => $order_items, 'user' => $user ? [ 'name' => $user->name, 'email' => $user->email, 'phone_number' => $user->phone_number, ] : [], '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
|
Настройка