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