CourseWork/app/Models/Lesson.php
2024-05-08 13:34:54 +04:00

44 lines
862 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',
'description',
'lesson_date',
'grade_id',
'teacher_id',
'subject_id',
];
public function scores(): HasMany
{
return $this->hasMany(Score::class);
}
public function grade(): BelongsTo
{
return $this->belongsTo(Grade::class);
}
public function teacher(): BelongsTo
{
return $this->belongsTo(Teacher::class);
}
public function subject(): BelongsTo
{
return $this->belongsTo(Subject::class);
}
}