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
Tag
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
 faqs
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 Engelsystem\Models\Shifts\Shift;
8use Illuminate\Database\Eloquent\Builder;
9use Illuminate\Database\Eloquent\Collection;
10use Illuminate\Database\Eloquent\Factories\HasFactory;
11use Illuminate\Database\Eloquent\Relations\BelongsToMany;
12
13/**
14 * @property int $id
15 * @property string $name
16 *
17 * @property-read Collection|Faq[]   $faqs
18 * @property-read Collection|Shift[] $shifts
19 *
20 * @method static Builder|Group whereId($value)
21 * @method static Builder|Group whereName($value)
22 */
23class Tag extends BaseModel
24{
25    use HasFactory;
26
27    /** @var string[] */
28    protected $fillable = [ // phpcs:ignore
29        'name',
30    ];
31
32    public function faqs(): BelongsToMany
33    {
34        return $this->belongsToMany(Faq::class, 'faq_tags');
35    }
36
37    public function shifts(): BelongsToMany
38    {
39        return $this->belongsToMany(Shift::class, 'shift_tags');
40    }
41}