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