Create an API feature for managing student attendance. Requirements: 1. Create two models: - AttendanceSession Fields: - id - teacher_id - school_id - level_id - class_id - subject_id - attendance_date (date) - start_time (time) - StudentAttendance Fields: - id - attendance_session_id (foreign key) - student_id - status (enum: hadir, izin, sakit, alfa) - note (nullable text) 2. The API should accept a request like this: { "date": "20-12-2025", "time": "10:00:00", "class_id": "1", "subject_id": "1", "students": [ { "student_id": 1, "status": "hadir" } ] } 3. The API should: - Create an AttendanceSession record - Then create multiple StudentAttendance records - Use Service and Repository pattern - Implement StudentAttendanceService ----------------------------------------------------------------------------- Create a REST API feature for managing student attendance. Architecture: - Use Service and Repository Pattern - Implement StudentAttendanceService - Use database transactions for create operation --------------------------------------- 1. Database Models --------------------------------------- A. AttendanceSession Fields: - id (primary key) - teacher_id (foreign key) - school_id (foreign key) - level_id (foreign key) - class_id (foreign key -> Classes.id) - subject_id (foreign key -> Subjects.id) - attendance_date (date) - start_time (time) - created_at - updated_at B. StudentAttendance Fields: - id (primary key) - attendance_session_id (foreign key) - student_id (foreign key) - status (enum: hadir, izin, sakit, alfa) - note (nullable text) - created_at - updated_at C. Classes Fields: - id - name - level_id D. Subjects Fields: - id - name Relationships: - One AttendanceSession belongs to one Class - One AttendanceSession belongs to one Subject - One AttendanceSession has many StudentAttendances - One StudentAttendance belongs to one AttendanceSession --------------------------------------- 2. List & Filter AttendanceSessions --------------------------------------- Features: - List AttendanceSessions - Filter by attendance_date - Include related Class and Subject data - Include aggregated count of StudentAttendance by status: - hadir_count - izin_count - sakit_count - alfa_count - Add pagination --------------------------------------- 3. Make detail AttendanceSessions by id --------------------------------------- Example Response: { "id": 1, "attendance_date": "2025-12-20", "start_time": "10:00:00", "class": { "id": 1, "name": "Class 1A" }, "subject": { "id": 1, "name": "Mathematics" }, "hadir_count": 25, "izin_count": 2, "sakit_count": 1, "alfa_count": 0, "stundets":[ { "name":"student name", "status":"hadir" } ] }