store-manage/app/Http/Resources/TrainExaminationResource.php

27 lines
653 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class TrainExaminationResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
// 'questions' => $this->questions,
'total_questions' => $this->total_questions,
'total_score' => $this->total_score,
'published_at' => $this->published_at?->timestamp,
];
}
}