id(); $table->foreignId('student_id')->constrained()->cascadeOnDelete(); $table->foreignId('course_schedule_id')->constrained()->cascadeOnDelete(); $table->date('date'); $table->timestamp('attended_at')->nullable(); $table->timestamps(); $table->unique(['student_id', 'course_schedule_id', 'date']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('attendances'); } };