29 lines
842 B
PHP
29 lines
842 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RiceShrimpPriceResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'year' => $this->year,
|
|
'quarter' => $this->quarter,
|
|
'price' => $this->price,
|
|
'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')),
|
|
'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')),
|
|
'created_at' => $this->created_at->unix(),
|
|
'updated_at' => $this->updated_at->unix(),
|
|
];
|
|
}
|
|
}
|