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
ScheduleShift
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
 schedule
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 shift
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\BaseModel;
8use Illuminate\Database\Eloquent\Relations\BelongsTo;
9use Illuminate\Database\Query\Builder as QueryBuilder;
10
11/**
12 * @property int                        $shift_id
13 * @property int                        $schedule_id
14 * @property string                     $guid
15 *
16 * @property-read QueryBuilder|Schedule $schedule
17 * @property-read QueryBuilder|Shift    $shift
18 *
19 * @method static QueryBuilder|ScheduleShift[] whereShiftId($value)
20 * @method static QueryBuilder|ScheduleShift[] whereScheduleId($value)
21 * @method static QueryBuilder|ScheduleShift[] whereGuid($value)
22 */
23class ScheduleShift extends BaseModel
24{
25    /** @var string The primary key for the model */
26    protected $primaryKey = 'shift_id'; // phpcs:ignore
27
28    /** @var string Required because it is not schedule_shifts */
29    protected $table = 'schedule_shift'; // phpcs:ignore
30
31    /** @var array<string> Values that are mass assignable */
32    protected $fillable = ['shift_id', 'schedule_id', 'guid']; // phpcs:ignore
33
34    /** @var array<string, string> */
35    protected $casts = [ // phpcs:ignore
36        'shift_id'    => 'integer',
37        'schedule_id' => 'integer',
38    ];
39
40    public function schedule(): BelongsTo
41    {
42        return $this->belongsTo(Schedule::class);
43    }
44
45    public function shift(): BelongsTo
46    {
47        return $this->belongsTo(Shift::class);
48    }
49}