PM_Console/backend/app/Http/Resources/MeetingResource.php

35 خطوط
1.2 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class MeetingResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'title' => $this->title,
'project_id' => $this->project_id,
'project' => new ProjectResource($this->whenLoaded('project')),
'date' => $this->date?->format('Y-m-d'),
'start_time' => $this->start_time,
'end_time' => $this->end_time,
'location' => $this->location,
'meeting_link' => $this->meeting_link,
'meeting_type' => $this->meeting_type,
'agenda' => $this->agenda,
'notes' => $this->notes,
'decisions' => $this->decisions,
'participants' => UserResource::collection($this->whenLoaded('participants')),
'action_items' => MeetingActionItemResource::collection($this->whenLoaded('actionItems')),
'created_by' => $this->created_by,
'creator' => new UserResource($this->whenLoaded('creator')),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}