Skip to content

Commit 1c2ee72

Browse files
Update helpers.php
1 parent 940bab3 commit 1c2ee72

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

app/helpers.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
<?php
22

33
use Modules\Setting\app\Models\Setting;
4-
use Illuminate\Support\Facades\Cache;
5-
use Illuminate\Support\Str;
64

75
if (!function_exists('setting')) {
86
function setting(String|array $name, $default = null)
97
{
108
if (is_string($name)) {
11-
$changed = false; // $user->isDirty(); // true
12-
$prefix = "settings." . Str::slug($name, '.');
13-
if (Cache::has($prefix) and !$changed) {
14-
return Cache::get($prefix);
15-
}
16-
179
$setting = Setting::where('name', $name)->Orwhere('config', $name)->value('value') ?? $default;
18-
19-
Cache::put($prefix, $setting, 60);
2010
return $setting;
2111
} else {
2212
foreach ($name as $key => $value) {
2313
$setting = Setting::firstOrCreate(['name' => $key, 'value' => $value])->value('value');
24-
25-
$prefix = "settings." . Str::slug($key, '.');
26-
Cache::put($prefix, $setting, 60);
2714
}
2815
}
2916
}

0 commit comments

Comments
 (0)