CourseWork/app/Models/Lesson.php
2024-05-08 12:59:29 +04:00

43 lines
842 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Lesson extends Model
{
use HasFactory;
protected $fillable = [
'name',
'type',
'lesson_date',
'grade_id',
'teacher_id',
'subject_id',
];
public function scores(): HasMany
{
return $this->hasMany(Score::class);
}
public function grades(): BelongsTo
{
return $this->belongsTo(Grade::class);
}
public function teachers(): BelongsTo
{
return $this->belongsTo(Teacher::class);
}
public function subjects(): BelongsTo
{
return $this->belongsTo(Subject::class);
}
}