| 123456789101112131415161718192021222324 |
- <?php
- namespace App\Http\Resources;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class CommentResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'submission_id' => $this->submission_id,
- 'author' => $this->author,
- 'content' => $this->content,
- 'created_at' => $this->created_at->toISOString(),
- 'updated_at' => $this->updated_at->toISOString(),
-
- 'submission' => new SubmissionResource($this->whenLoaded('submission')),
- 'attachments' => AttachmentResource::collection($this->whenLoaded('attachments')),
- ];
- }
- }
|