id(); $table->foreignId('student_id')->constrained()->cascadeOnDelete(); $table->date('date'); $table->unsignedTinyInteger('lesson_hour')->comment('Jam ke- 1 s.d 10'); $table->string('status', 20)->default('hadir')->comment('hadir|sakit|izin|alpha|terlambat'); $table->text('notes')->nullable(); $table->foreignId('recorded_by')->nullable()->constrained('users')->nullOnDelete(); $table->timestamps(); $table->unique(['student_id', 'date', 'lesson_hour'], 'attendance_unique'); $table->index('date'); $table->index('status'); }); } public function down(): void { Schema::dropIfExists('attendances'); } };