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

SettingObserver::updated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
nc 1
cc 1
eloc 2
nop 1
crap 1
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