CourseWork/app/Models/Lesson.php

43 lines
842 B
PHP
Raw Normal View History

2024-05-07 17:16:34 +04:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
2024-05-08 12:15:55 +04:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2024-05-08 11:39:35 +04:00
use Illuminate\Database\Eloquent\Relations\HasMany;
2024-05-07 17:16:34 +04:00
class Lesson extends Model
{
use HasFactory;
protected $fillable = [
'name',
'type',
'lesson_date',
2024-05-08 12:59:29 +04:00
'grade_id',
'teacher_id',
'subject_id',
2024-05-07 17:16:34 +04:00
];
2024-05-08 11:39:35 +04:00
public function scores(): HasMany
{
return $this->hasMany(Score::class);
}
2024-05-08 12:15:55 +04:00
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);
}
2024-05-07 17:16:34 +04:00
}