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
Location
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
 activeForSchedules
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 neededAngelTypes
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;
6
7use Carbon\Carbon;
8use Engelsystem\Models\Shifts\NeededAngelType;
9use Engelsystem\Models\Shifts\Schedule;
10use Engelsystem\Models\Shifts\Shift;
11use Illuminate\Database\Eloquent\Collection;
12use Illuminate\Database\Eloquent\Factories\HasFactory;
13use Illuminate\Database\Eloquent\Relations\BelongsToMany;
14use Illuminate\Database\Eloquent\Relations\HasMany;
15use 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 */
38class 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}