aboutsummaryrefslogtreecommitdiffstats
path: root/app/Models/SubGroup.php
blob: 12a3ec5ecf6ebef94b0f7fcaab70d58911599c09 (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
<?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 SubGroup extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'group_id',
    ];

    /**
     * Get the parent group.
     */
    public function group(): BelongsTo
    {
        return $this->belongsTo(Group::class);
    }

    /**
     * Get the students in this sub-group.
     */
    public function students(): HasMany
    {
        return $this->hasMany(Student::class);
    }
}