Completed
Push — dev ( 2d3105...cb6296 )
by Amr
02:54
created

SettingObserver::deleted()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Merodiro\Settings\Observers;
4
5
use Illuminate\Support\Facades\Cache;
6
use Merodiro\Settings\Models\Setting;
7
8
class SettingObserver
9
{
10 8
    public function deleted(Setting $setting)
11
    {
12 8
        $suffix = $setting->owner_id ? $setting->owner_id: 'global';
13
14 8
        $cache_key = config('settings.cache_prefix') . $setting->key . '_' . $suffix;
15
16 8
        Cache::forget($cache_key);
17 8
    }
18
}
19