/** * @param string $group * @param array $settings * @return bool */ public function updateSettingsByGroup($group = 'general', $settings = []) { foreach ($settings as $setting) { $model = Setting::whereGroup($group)->whereKey($setting['key'])->first(); $model->fill(['value' => $setting['value']]); if (!$model->save()) { return false; } } return true; }