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

29 lines
563 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SchoolClass extends Model
{
use HasFactory;
protected $fillable = [
'number',
'letter',
'profile',
];
public function students()
{
return $this->hasMany(Student::class, 'class_id');
}
public function subjects()
{
return $this->belongsToMany(Subject::class, 'academic_plans', 'class_id')
->withPivot('hours_per_week', 'hours_per_year');
}
}