mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
31 lines
737 B
PHP
31 lines
737 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Exam;
|
|
use App\Models\User;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ExamUserResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'status' => $this->status,
|
|
'status_text' => $this->statusText,
|
|
'created_at' => $this->created_at->format('Y-m-d H:i:s'),
|
|
'user' => new UserResource($this->whenLoaded('user')),
|
|
'exam' => new ExamResource($this->whenLoaded('exam')),
|
|
];
|
|
}
|
|
|
|
}
|