Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
ShiftType
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 neededAngelTypes
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 schedules
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 shifts
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Models\Shifts;
6
7use Engelsystem\Models\BaseModel;
8use Illuminate\Database\Eloquent\Collection;
9use Illuminate\Database\Eloquent\Factories\HasFactory;
10use Illuminate\Database\Eloquent\Relations\HasMany;
11use Illuminate\Database\Query\Builder as QueryBuilder;
12
13/**
14 * @property int                        $id
15 * @property string                     $name
16 * @property string                     $description
17 *
18 * @property-read Collection|NeededAngelType[] $neededAngelTypes
19 * @property-read Collection|Schedule[] $schedules
20 * @property-read Collection|Shift[]    $shifts
21 *
22 * @method static QueryBuilder|ShiftType[] whereId($value)
23 * @method static QueryBuilder|ShiftType[] whereName($value)
24 * @method static QueryBuilder|ShiftType[] whereDescription($value)
25 */
26class ShiftType extends BaseModel
27{
28    use HasFactory;
29
30    /** @var array<string> */
31    protected $fillable = [ // phpcs:ignore
32        'name',
33        'description',
34    ];
35
36    public function neededAngelTypes(): HasMany
37    {
38        return $this->hasMany(NeededAngelType::class);
39    }
40
41    public function schedules(): HasMany
42    {
43        return $this->hasMany(Schedule::class, 'shift_type');
44    }
45
46    public function shifts(): HasMany
47    {
48        return $this->hasMany(Shift::class);
49    }
50}