add more controller

This commit is contained in:
root
2026-03-10 00:48:32 -04:00
parent 5eeaec0257
commit 20ee70d153
151 changed files with 9481 additions and 8407 deletions
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Resources\EmergencyContacts;
use Illuminate\Http\Resources\Json\JsonResource;
class EmergencyContactGroupResource extends JsonResource
{
public function toArray($request): array
{
return [
'parent_id' => (int) ($this['parent_id'] ?? 0),
'parent_name' => (string) ($this['parent_name'] ?? ''),
'parent_phones' => array_values($this['parent_phones'] ?? []),
'students' => EmergencyContactStudentResource::collection($this['students'] ?? []),
'contacts' => EmergencyContactResource::collection($this['contacts'] ?? []),
];
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Resources\EmergencyContacts;
use Illuminate\Http\Resources\Json\JsonResource;
class EmergencyContactResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'parent_id' => (int) ($this['parent_id'] ?? 0),
'name' => (string) ($this['emergency_contact_name'] ?? ''),
'cellphone' => (string) ($this['cellphone'] ?? ''),
'email' => $this['email'] ?? null,
'relation' => $this['relation'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
];
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Resources\EmergencyContacts;
use Illuminate\Http\Resources\Json\JsonResource;
class EmergencyContactStudentResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'firstname' => (string) ($this['firstname'] ?? ''),
'lastname' => (string) ($this['lastname'] ?? ''),
'school_id' => $this['school_id'] ?? null,
];
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Resources\Exams;
use Illuminate\Http\Resources\Json\JsonResource;
class ExamDraftResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'teacher_id' => (int) ($this['teacher_id'] ?? 0),
'class_section_id' => (int) ($this['class_section_id'] ?? 0),
'class_section_name' => $this['class_section_name'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
'exam_type' => $this['exam_type'] ?? null,
'draft_title' => $this['draft_title'] ?? null,
'description' => $this['description'] ?? null,
'teacher_file' => $this['teacher_file'] ?? null,
'teacher_filename' => $this['teacher_filename'] ?? null,
'status' => $this['status'] ?? null,
'admin_id' => $this['admin_id'] ?? null,
'admin_comments' => $this['admin_comments'] ?? null,
'reviewed_at' => $this['reviewed_at'] ?? null,
'final_file' => $this['final_file'] ?? null,
'final_filename' => $this['final_filename'] ?? null,
'final_pdf_file' => $this['final_pdf_file'] ?? null,
'version' => $this['version'] ?? null,
'previous_draft_id' => $this['previous_draft_id'] ?? null,
'is_legacy' => $this['is_legacy'] ?? null,
'teacher_first' => $this['teacher_first'] ?? null,
'teacher_last' => $this['teacher_last'] ?? null,
'admin_first' => $this['admin_first'] ?? null,
'admin_last' => $this['admin_last'] ?? null,
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources\Parents;
use Illuminate\Http\Resources\Json\JsonResource;
class ParentAttendanceReportResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'parent_id' => (int) ($this['parent_id'] ?? 0),
'student_id' => (int) ($this['student_id'] ?? 0),
'class_section_id' => $this['class_section_id'] ?? null,
'report_date' => (string) ($this['report_date'] ?? ''),
'type' => (string) ($this['type'] ?? ''),
'arrival_time' => $this['arrival_time'] ?? null,
'dismiss_time' => $this['dismiss_time'] ?? null,
'reason' => $this['reason'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
'status' => $this['status'] ?? null,
'firstname' => $this['firstname'] ?? null,
'lastname' => $this['lastname'] ?? null,
'class_section_name' => $this['class_section_name'] ?? null,
];
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Resources\Parents;
use Illuminate\Http\Resources\Json\JsonResource;
class ParentAttendanceResource extends JsonResource
{
public function toArray($request): array
{
return [
'firstname' => (string) ($this['firstname'] ?? ''),
'lastname' => (string) ($this['lastname'] ?? ''),
'date' => (string) ($this['date'] ?? ''),
'status' => (string) ($this['status'] ?? ''),
'reason' => $this['reason'] ?? null,
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Parents;
use Illuminate\Http\Resources\Json\JsonResource;
class ParentEmergencyContactResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'name' => (string) ($this['emergency_contact_name'] ?? ''),
'cellphone' => (string) ($this['cellphone'] ?? ''),
'email' => $this['email'] ?? null,
'relation' => $this['relation'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources\Parents;
use Illuminate\Http\Resources\Json\JsonResource;
class ParentStudentResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'firstname' => (string) ($this['firstname'] ?? ''),
'lastname' => (string) ($this['lastname'] ?? ''),
'dob' => $this['dob'] ?? null,
'gender' => $this['gender'] ?? null,
'registration_grade' => $this['registration_grade'] ?? null,
'school_year' => $this['school_year'] ?? null,
'semester' => $this['semester'] ?? null,
'class_section' => $this['class_section'] ?? null,
'enrollment_status' => $this['enrollment_status'] ?? null,
'admission_status' => $this['admission_status'] ?? null,
'disable_enroll' => (bool) ($this['disable_enroll'] ?? false),
'allergies' => $this['allergies'] ?? [],
'medical_conditions' => $this['medical_conditions'] ?? [],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Resources\Reports;
use Illuminate\Http\Resources\Json\JsonResource;
class LateSlipLogResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'school_year' => (string) ($this['school_year'] ?? ''),
'semester' => (string) ($this['semester'] ?? ''),
'student_name' => (string) ($this['student_name'] ?? ''),
'date' => $this['date'] ?? null,
'time_in' => $this['time_in'] ?? null,
'grade' => $this['grade'] ?? null,
'reason' => $this['reason'] ?? null,
'admin_name' => $this['admin_name'] ?? null,
'printed_at' => $this['printed_at'] ?? null,
];
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Http\Resources\SchoolIds;
use Illuminate\Http\Resources\Json\JsonResource;
class SchoolIdResource extends JsonResource
{
public function toArray($request): array
{
return [
'type' => $this['type'] ?? null,
'school_id' => $this['school_id'] ?? null,
];
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Resources\Settings;
use Illuminate\Http\Resources\Json\JsonResource;
class ConfigurationResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'config_key' => (string) ($this['config_key'] ?? ''),
'config_value' => (string) ($this['config_value'] ?? ''),
];
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Resources\Students;
use Illuminate\Http\Resources\Json\JsonResource;
class StudentAssignmentResource extends JsonResource
{
public function toArray($request): array
{
return [
'student_id' => (int) ($this['student_id'] ?? 0),
'name' => (string) ($this['name'] ?? ''),
'age' => $this['age'] ?? null,
'email' => $this['email'] ?? null,
'phone' => $this['phone'] ?? null,
'registration_grade' => $this['registration_grade'] ?? null,
'class_section_name' => $this['class_section_name'] ?? null,
'class_section_names' => $this['class_section_names'] ?? [],
'class_section_ids' => $this['class_section_ids'] ?? [],
'new_student' => $this['new_student'] ?? null,
'registration_date' => $this['registration_date'] ?? null,
'school_year' => $this['school_year'] ?? null,
'semester' => $this['semester'] ?? null,
];
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Resources\Students;
use Illuminate\Http\Resources\Json\JsonResource;
class StudentClassSectionResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'class_section_id' => (int) ($this['class_section_id'] ?? 0),
'class_section_name' => (string) ($this['class_section_name'] ?? ''),
'school_year' => $this['school_year'] ?? null,
];
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Resources\Students;
use Illuminate\Http\Resources\Json\JsonResource;
class StudentRemovedResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'school_id' => $this['school_id'] ?? null,
'firstname' => $this['firstname'] ?? null,
'lastname' => $this['lastname'] ?? null,
'gender' => $this['gender'] ?? null,
'age' => $this['age'] ?? null,
'class_sections' => $this['class_sections'] ?? [],
'class_section_name' => $this['class_section_name'] ?? null,
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources\Students;
use Illuminate\Http\Resources\Json\JsonResource;
class StudentScoreCardRowResource extends JsonResource
{
public function toArray($request): array
{
return [
'school_year' => $this['school_year'] ?? null,
'semester' => $this['semester'] ?? null,
'homework_avg' => $this['homework_avg'] ?? null,
'project_avg' => $this['project_avg'] ?? null,
'participation_score' => $this['participation_score'] ?? null,
'quiz_avg' => $this['quiz_avg'] ?? null,
'test_avg' => $this['test_avg'] ?? null,
'attendance_score' => $this['attendance_score'] ?? null,
'ptap_score' => $this['ptap_score'] ?? null,
'midterm_exam_score' => $this['midterm_exam_score'] ?? null,
'semester_score' => $this['semester_score'] ?? null,
'class_section_name' => $this['class_section_name'] ?? null,
'comments' => $this['comments'] ?? [],
'year_score' => $this['year_score'] ?? null,
];
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Resources\Subjects;
use Illuminate\Http\Resources\Json\JsonResource;
class SubjectClassResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'class_name' => (string) ($this['class_name'] ?? ''),
'school_year' => $this['school_year'] ?? null,
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Subjects;
use Illuminate\Http\Resources\Json\JsonResource;
class SubjectCurriculumResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'class_id' => (int) ($this['class_id'] ?? 0),
'class_name' => $this['class_name'] ?? null,
'subject' => (string) ($this['subject'] ?? ''),
'unit_number' => $this['unit_number'] ?? null,
'unit_title' => $this['unit_title'] ?? null,
'chapter_name' => (string) ($this['chapter_name'] ?? ''),
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Teachers;
use Illuminate\Http\Resources\Json\JsonResource;
class TeacherAbsenceResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'user_id' => (int) ($this['user_id'] ?? 0),
'date' => (string) ($this['date'] ?? ''),
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
'status' => $this['status'] ?? null,
'reason' => $this['reason'] ?? null,
];
}
}
@@ -0,0 +1,24 @@
<?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'] ?? [],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Teachers;
use Illuminate\Http\Resources\Json\JsonResource;
class TeacherClassResource extends JsonResource
{
public function toArray($request): array
{
return [
'class_section_id' => (int) ($this['class_section_id'] ?? 0),
'class_section_name' => (string) ($this['class_section_name'] ?? ''),
'class_id' => $this['class_id'] ?? null,
'class_name' => $this['class_name'] ?? null,
'teacher_role' => $this['teacher_role'] ?? null,
'school_year' => $this['school_year'] ?? null,
'semester' => $this['semester'] ?? null,
];
}
}
@@ -0,0 +1,27 @@
<?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'] ?? '',
];
}
}