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',
|
2024-05-08 13:34:54 +04:00
|
|
|
'description',
|
2024-05-07 17:16:34 +04:00
|
|
|
'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
|
|
|
|
2024-05-08 13:34:54 +04:00
|
|
|
public function grade(): BelongsTo
|
2024-05-08 12:15:55 +04:00
|
|
|
{
|
|
|
|
return $this->belongsTo(Grade::class);
|
|
|
|
}
|
|
|
|
|
2024-05-08 13:34:54 +04:00
|
|
|
public function teacher(): BelongsTo
|
2024-05-08 12:15:55 +04:00
|
|
|
{
|
|
|
|
return $this->belongsTo(Teacher::class);
|
|
|
|
}
|
|
|
|
|
2024-05-08 13:34:54 +04:00
|
|
|
public function subject(): BelongsTo
|
2024-05-08 12:15:55 +04:00
|
|
|
{
|
|
|
|
return $this->belongsTo(Subject::class);
|
|
|
|
}
|
2024-05-07 17:16:34 +04:00
|
|
|
}
|