QueenFruits/Backend/app/Http/Resources/Product/ProductReviewResource.php

25 lines
547 B
PHP

<?php
namespace App\Http\Resources\Product;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ProductReviewResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->uuid,
'customer_name' => $this->customer->name,
'rating_count' => $this->rating,
'comment' => $this->comment
];
}
}