1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 02:44:31 +00:00

исправление ошибок

This commit is contained in:
nikden13
2020-12-08 16:45:27 +07:00
parent 45bec16c7f
commit 5b0ba96adf
7 changed files with 88 additions and 24 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AcademicPlan extends Model
{
use HasFactory;
protected $primaryKey = ['subject_id', 'class_id'];
public $incrementing = false;
}

View File

@@ -19,4 +19,10 @@ class SchoolClass extends Model
{
return $this->hasMany(Student::class);
}
public function subjects()
{
return $this->belongsToMany(Subject::class, 'academic_plans')->withPivot('hours_per_week', 'hours_per_year');
}
}

View File

@@ -17,4 +17,10 @@ class Subject extends Model
{
return $this->hasMany(BankTask::class);
}
public function schoolClasses()
{
return $this->belongsToMany(SchoolClass::class, 'academic_plans')->withPivot('hours_per_week', 'hours_per_year');
}
}