File "ProductResource.php"
Full Path: /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Http/Resources/Admin/ProductResource.php
File size: 805 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace App\Http\Resources\Admin;
use App\Models\Product;
use Illuminate\Http\Resources\Json\JsonResource;
class ProductResource extends JsonResource
{
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'sku' => $this->sku,
'slug' => $this->slug,
'category' => $this->category?->name,
'featured_image' => $this->featured_image?->thumbnail,
'status' => $this->status_name,
'is_draft' => Product::DRAFT_RADIO[$this->is_draft],
'product_type' => Product::PRODUCT_TYPE[$this->product_type],
'created_at' => $this->created_at->format('m-d-Y'),
'updated_at' => $this->updated_at->format('m-d-Y'),
];
}
}