Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ShiftEntry
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 shift
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 angelType
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\AngelType;
8use Engelsystem\Models\BaseModel;
9use Engelsystem\Models\User\UsesUserModel;
10use Illuminate\Database\Eloquent\Factories\HasFactory;
11use Illuminate\Database\Eloquent\Relations\BelongsTo;
12use Illuminate\Database\Query\Builder as QueryBuilder;
13
14/**
15 * @property int            $id
16 * @property int            $shift_id
17 * @property int            $angel_type_id
18 * @property string         $user_comment
19 * @property bool           $freeloaded
20 * @property string         $freeloaded_comment
21 *
22 * @property-read Shift     $shift
23 * @property-read AngelType $angelType
24 *
25 * @method static QueryBuilder|ShiftEntry[] whereId($value)
26 * @method static QueryBuilder|ShiftEntry[] whereShiftId($value)
27 * @method static QueryBuilder|ShiftEntry[] whereAngelTypeId($value)
28 * @method static QueryBuilder|ShiftEntry[] whereUserComment($value)
29 * @method static QueryBuilder|ShiftEntry[] whereFreeloaded($value)
30 * @method static QueryBuilder|ShiftEntry[] whereFreeloadedComment($value)
31 */
32class ShiftEntry extends BaseModel
33{
34    use HasFactory;
35    use UsesUserModel;
36
37    /** @var array<string, string|bool> default attributes */
38    protected $attributes = [ // phpcs:ignore
39        'user_comment'       => '',
40        'freeloaded'         => false,
41        'freeloaded_comment' => '',
42    ];
43
44    /** @var array<string> */
45    protected $fillable = [ // phpcs:ignore
46        'shift_id',
47        'angel_type_id',
48        'user_id',
49        'user_comment',
50        'freeloaded',
51        'freeloaded_comment',
52    ];
53
54    /** @var array<string, string> */
55    protected $casts = [ // phpcs:ignore
56        'shift_id' => 'integer',
57        'angel_type_id' => 'integer',
58        'user_id' => 'integer',
59        'freeloaded' => 'bool',
60    ];
61
62    /** @var array<string> Attributes which should not be serialized */
63    protected $hidden = [ // phpcs:ignore
64        'freeloaded_comment',
65    ];
66
67    public function shift(): BelongsTo
68    {
69        return $this->belongsTo(Shift::class);
70    }
71
72    public function angelType(): BelongsTo
73    {
74        return $this->belongsTo(AngelType::class);
75    }
76}