Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
Location | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
activeForSchedules | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
neededAngelTypes | |
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; |
6 | |
7 | use Carbon\Carbon; |
8 | use Engelsystem\Models\Shifts\NeededAngelType; |
9 | use Engelsystem\Models\Shifts\Schedule; |
10 | use Engelsystem\Models\Shifts\Shift; |
11 | use Illuminate\Database\Eloquent\Collection; |
12 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
13 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
14 | use Illuminate\Database\Eloquent\Relations\HasMany; |
15 | use Illuminate\Database\Query\Builder as QueryBuilder; |
16 | |
17 | /** |
18 | * @property int $id |
19 | * @property string $name |
20 | * @property string|null $map_url |
21 | * @property string|null $description |
22 | * @property string|null $dect |
23 | * @property Carbon|null $created_at |
24 | * @property Carbon|null $updated_at |
25 | * |
26 | * @property-read Collection|Schedule[] $activeForSchedules |
27 | * @property-read Collection|NeededAngelType[] $neededAngelTypes |
28 | * @property-read Collection|Shift[] $shifts |
29 | * |
30 | * @method static QueryBuilder|Location[] whereId($value) |
31 | * @method static QueryBuilder|Location[] whereName($value) |
32 | * @method static QueryBuilder|Location[] whereMapUrl($value) |
33 | * @method static QueryBuilder|Location[] whereDect($value) |
34 | * @method static QueryBuilder|Location[] whereDescription($value) |
35 | * @method static QueryBuilder|Location[] whereCreatedAt($value) |
36 | * @method static QueryBuilder|Location[] whereUpdatedAt($value) |
37 | */ |
38 | class Location extends BaseModel |
39 | { |
40 | use HasFactory; |
41 | |
42 | /** @var bool Enable timestamps */ |
43 | public $timestamps = true; // phpcs:ignore |
44 | |
45 | /** @var array<string, null> default attributes */ |
46 | protected $attributes = [ // phpcs:ignore |
47 | 'map_url' => null, |
48 | 'description' => null, |
49 | 'dect' => null, |
50 | ]; |
51 | |
52 | /** @var array<string> */ |
53 | protected $fillable = [ // phpcs:ignore |
54 | 'name', |
55 | 'dect', |
56 | 'map_url', |
57 | 'description', |
58 | ]; |
59 | |
60 | public function activeForSchedules(): BelongsToMany |
61 | { |
62 | return $this->belongsToMany(Schedule::class, 'schedule_locations'); |
63 | } |
64 | |
65 | public function neededAngelTypes(): HasMany |
66 | { |
67 | return $this->hasMany(NeededAngelType::class); |
68 | } |
69 | |
70 | public function shifts(): HasMany |
71 | { |
72 | return $this->hasMany(Shift::class); |
73 | } |
74 | } |