blob: ccd7fc548b95102c93e2a325869577d0c205230d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Group extends Model
{
use HasFactory;
protected $fillable = [
'name',
'teacher_id',
];
/**
* Get the teacher that owns the group.
*/
public function teacher(): BelongsTo
{
return $this->belongsTo(Teacher::class);
}
/**
* Get the students in this group.
*/
public function students(): HasMany
{
return $this->hasMany(Student::class);
}
/**
* Get the sub-groups for this group.
*/
public function subGroups(): HasMany
{
return $this->hasMany(SubGroup::class);
}
/**
* Get the lessons for this group.
*/
public function lessons(): HasMany
{
return $this->hasMany(Lesson::class);
}
}
|