File tree Expand file tree Collapse file tree 1 file changed +0
-13
lines changed
Expand file tree Collapse file tree 1 file changed +0
-13
lines changed Original file line number Diff line number Diff line change 11<?php
22
33use Modules \Setting \app \Models \Setting ;
4- use Illuminate \Support \Facades \Cache ;
5- use Illuminate \Support \Str ;
64
75if (!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 }
You can’t perform that action at this time.
0 commit comments