diff --git a/app/Models/HistoricalSeat.php b/app/Models/HistoricalSeat.php new file mode 100644 index 0000000..cff2db9 --- /dev/null +++ b/app/Models/HistoricalSeat.php @@ -0,0 +1,17 @@ +belongsTo(Student::class); + } +} diff --git a/app/Models/Student.php b/app/Models/Student.php index 925fc29..2554aa2 100644 --- a/app/Models/Student.php +++ b/app/Models/Student.php @@ -45,6 +45,11 @@ class Student extends Model return $this->belongsTo(School::class); } + public function historicalSeats(): HasMany + { + return $this->hasMany(HistoricalSeat::class); + } + public function users(): HasManyThrough { return $this->hasManyThrough( diff --git a/database/migrations/2025_05_07_195828_create_historical_seats_table.php b/database/migrations/2025_05_07_195828_create_historical_seats_table.php new file mode 100644 index 0000000..8d52912 --- /dev/null +++ b/database/migrations/2025_05_07_195828_create_historical_seats_table.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + $table->foreignIdFor(Student::class)->constrained()->onDelete('cascade'); + $table->integer('year'); + $table->string('seat_description'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('historical_seats'); + } +};