Files
alrahma_sunday_school_api/app/Http/Resources/Teachers/TeacherStudentResource.php
T
2026-03-10 00:48:32 -04:00

28 lines
1.0 KiB
PHP

<?php
namespace App\Http\Resources\Teachers;
use Illuminate\Http\Resources\Json\JsonResource;
class TeacherStudentResource extends JsonResource
{
public function toArray($request): array
{
return [
'student_id' => (int) ($this['student_id'] ?? 0),
'firstname' => (string) ($this['firstname'] ?? ''),
'lastname' => (string) ($this['lastname'] ?? ''),
'school_id' => $this['school_id'] ?? null,
'is_new' => $this['is_new'] ?? null,
'photo_consent' => $this['photo_consent'] ?? null,
'age' => $this['age'] ?? null,
'school_year' => $this['school_year'] ?? null,
'class_section_id' => $this['class_section_id'] ?? null,
'medical_conditions' => $this['medical_conditions'] ?? [],
'allergies' => $this['allergies'] ?? [],
'medical_conditions_text' => $this['medical_conditions_text'] ?? '',
'allergies_text' => $this['allergies_text'] ?? '',
];
}
}