You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/app/Http/Resources/QunatityCollection.php

33 lines
843 B
PHTML

<?php
namespace App\Http\Resources;
2 weeks ago
use App\Models\Quantity;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\Json\ResourceCollection;
class QunatityCollection extends JsonResource
{
/**
* Transform the resource collection into an array.
*
* @return array<int|string, mixed>
*/
public function toArray(Request $request): array
{
2 weeks ago
/**
* @var $this Quantity
*/
return [
'id' => $this->id,
'product_name' => $this->product->name,
'count' => $this->count,
'data'=> json_decode($this->data),
'meta' => $this->meta,
'price'=> $this->price,
2 weeks ago
'image' => $this->product->getMedia()[$this->image]->getUrl('product-image'),
];
}
}