Completed
Push — dev ( 97298e...06ed0d )
by Amr
02:10
created

Setting::getCacheKeyAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Merodiro\Settings\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Setting extends Model
8
{
9
    protected $fillable = ['key', 'value', 'owner_id'];
10
11
12 40
    public function getCacheKeyAttribute()
13
    {
14 40
        $suffix = $this->owner_id ?? 'global';
15 40
        return config('settings.cache_prefix') . $this->key . '_' . $suffix;
16
    }
17
}
18