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

25 lines
817 B
PHP

<?php
namespace App\Http\Resources\Teachers;
use Illuminate\Http\Resources\Json\JsonResource;
class TeacherAssignmentResource extends JsonResource
{
public function toArray($request): array
{
return [
'teacher_id' => (int) ($this['teacher_id'] ?? 0),
'firstname' => (string) ($this['firstname'] ?? ''),
'lastname' => (string) ($this['lastname'] ?? ''),
'name' => (string) ($this['name'] ?? ''),
'email' => $this['email'] ?? null,
'cellphone' => $this['cellphone'] ?? null,
'role' => $this['role'] ?? null,
'school_year' => $this['school_year'] ?? null,
'main_assignments' => $this['main_assignments'] ?? [],
'ta_assignments' => $this['ta_assignments'] ?? [],
];
}
}