Passed
Push — master ( 749264...58c143 )
by Quentin
05:27
created

Setting::getTranslationRelationKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace A17\Twill\Models;
4
5
use A17\Twill\Models\Behaviors\HasMedias;
6
use A17\Twill\Models\Behaviors\HasTranslation;
7
use Illuminate\Support\Str;
8
9
class Setting extends Model
10
{
11
    use HasTranslation, HasMedias;
0 ignored issues
show
introduced by
The trait A17\Twill\Models\Behaviors\HasMedias requires some properties which are not provided by A17\Twill\Models\Setting: $medias, $role, $pivot, $metadatas, $uuid, $height, $lqip_data, $crop_h, $locale, $video, $crop, $crop_w, $width
Loading history...
introduced by
The trait A17\Twill\Models\Behaviors\HasTranslation requires some properties which are not provided by A17\Twill\Models\Setting: $each, $locale, $active
Loading history...
12
13
    public $useTranslationFallback = true;
14
15
    protected $fillable = [
16
        'key',
17
        'section',
18
    ];
19
20
    public $translatedAttributes = [
21
        'value',
22
        'locale',
23
        'active',
24
    ];
25
26
    public function getTranslationModelNameDefault()
27
    {
28
        return "A17\Twill\Models\Translations\SettingTranslation";
29
    }
30
31
    public function getTable()
32
    {
33
        return config('twill.settings_table', 'twill_settings');
34
    }
35
36
    protected function getTranslationRelationKey(): string
37
    {
38
        return Str::singular(config('twill.settings_table', 'twill_settings')) . '_id';
39
    }
40
}
41