Completed
Push — master ( 6c4269...c17333 )
by Amr
02:01
created

SettingObserver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A updated() 0 6 1
A deleted() 0 6 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 4
    public function updated(Setting $setting)
11
    {
12 4
        $cache_key = config('settings.cache_prefix') . $setting->key;
13
14 4
        Cache::forget($cache_key);
15 4
    }
16
17 4
    public function deleted(Setting $setting)
18
    {
19 4
        $cache_key = config('settings.cache_prefix') . $setting->key;
20
21 4
        Cache::forget($cache_key);
22 4
    }
23
}
24