39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\CourseSchedule;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin CourseSchedule
|
|
*/
|
|
class CourseScheduleResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'course_id' => $this->course_id,
|
|
'course' => new CourseResource($this->whenLoaded('course')),
|
|
'start_date' => $this->start_date?->toDateString(),
|
|
'end_date' => $this->end_date?->toDateString(),
|
|
'location' => $this->location,
|
|
'instructor' => $this->instructor,
|
|
'quota' => $this->quota,
|
|
'available_seats' => $this->available_seats,
|
|
'enrolled_count' => $this->enrolled_count,
|
|
'price_override' => $this->price_override,
|
|
'status' => $this->status,
|
|
'is_urgent' => $this->is_urgent,
|
|
'notes' => $this->notes,
|
|
'created_at' => $this->created_at?->toISOString(),
|
|
'updated_at' => $this->updated_at?->toISOString(),
|
|
];
|
|
}
|
|
}
|