Файловый менеджер - Редактировать - /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Http/Resources/User/CartResource.php
Назад
<?php namespace App\Http\Resources\User; use Illuminate\Http\Resources\Json\JsonResource; class CartResource extends JsonResource { public function toArray($request) { $p_price = $this->price; $variations = []; foreach ($p_price?->combinations ?? [] as $combination){ if ($variation = $combination->variation){ $variations[] = [ 'type' => $variation->type, 'value' => $variation->value, ]; } } $range = $p_price->priceRanges() ->where('qty_from', '<=', $this->quantity) ->where('qty_to', '>=', $this->quantity) ->first(); return [ 'id' => $this->id, 'product' => [ 'id' => $this->product_id, 'name' => $this->product?->name, 'featured_image' => $this->product->featured_image ? [ 'url' => $this->product->featured_image->url, 'thumbnail' => $this->product->featured_image->thumbnail, 'preview' => $this->product->featured_image->preview, ] : [] ], 'price_id' => $this->price_id, 'quantity' => $this->quantity, 'total' => $this->quantity * $range?->price, 'customization' => $this->customization, 'attachment' => $this->attachment_url, 'variations' => $variations, ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка