芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/app/Models/Setting.php
first(); if ($old) { $old->value = $setting; $old->save(); return; } $set = new Setting(); $set->option = $key; $set->value = $setting; $set->save(); } public static function setSettings($settings) { foreach ($settings as $key => $value) { self::updateOrCreate( [ 'option' => $key, ], [ 'option' => $key, 'value' => $value, ] ); } } public static function getSetting($key) { $setting = static::whereOption($key)->first(); if ($setting) { return $setting->value; } else { return null; } } public static function getSettings($settings) { return static::whereIn('option', $settings) ->get()->mapWithKeys(function ($item) { return [$item['option'] => $item['value']]; }); } }