-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
135 additions
and
22 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use App\Models\MyClass; | ||
use App\Models\Section; | ||
use Illuminate\Database\Eloquent\Relations\Pivot; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
|
||
class AcademicYearStudentRecord extends Pivot | ||
{ | ||
/** | ||
* Indicates if the IDs are auto-incrementing. | ||
* | ||
* @var bool | ||
*/ | ||
public $incrementing = true; | ||
protected $fillable = ['my_class_id', 'section_id']; | ||
|
||
/** | ||
* Get the studentRecord that owns the AcademicYearStudentRecord | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function studentRecord(): BelongsTo | ||
{ | ||
return $this->belongsTo(StudentRecord::class, 'student_record_id', 'id'); | ||
} | ||
|
||
/** | ||
* Get the class that owns the AcademicYearStudentRecord | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function class(): BelongsTo | ||
{ | ||
return $this->belongsTo(MyClass::class, 'my_class_id', 'id'); | ||
} | ||
|
||
/** | ||
* Get the section that owns the AcademicYearStudentRecord | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function section(): BelongsTo | ||
{ | ||
return $this->belongsTo(Section::class, 'section_id', 'id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
database/migrations/2022_09_26_202726_create_academic_year_student_record_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::create('academic_year_student_record', static function (Blueprint $table) { | ||
$table->id(); | ||
$table->foreignId("academic_year_id")->notNullable()->onDelete("cascade")->onUpdate("cascade"); | ||
$table->foreignId("student_record_id")->notNullable()->onDelete("cascade")->onUpdate("cascade"); | ||
$table->foreignId("my_class_id")->notNullable()->onDelete("cascade")->onUpdate("cascade"); | ||
$table->foreignId("section_id")->notNullable()->onDelete("cascade")->onUpdate("cascade"); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists('academic_year_student_record'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters