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