FareedR
3 months ago
252
0
Laravel

Add new value in system setting

Posted 3 months ago by FareedR

My use case is : if system settings does not have the value " Day " ( an example ) , field value will add " Day " in the system settings . Involved with array . User might put 2 value " Day " and " Weekend " . And of course , key must be sequence based on database .

// controller
$signals = $request->get('signal') // might be an array , might not . 
$default_signal         = Helper::getSetting('signal');
$json_default_signals   = json_decode($default_signal,true);
$counter_signal         = count($json_default_signals);
foreach($signals as $signal){
    // idk how to iterate 
}
// database 
key |     value 
signal	[{"key":1,"text":"3","value":"3"},{"key":2,"text":"15","value":"15"},{"key":3,"text":"60","value":"60"},{"key":4,"text":"300","value":"300"},{"key":5,"text":"Daily","value":"Daily"},{"key":6,"text":"Weekly","value":"Weekly"}]

Please sign in or create an account to participate in this conversation.