groupBy('group'); return view('admin.settings.index', compact('settings')); } public function update(Request $request) { $settings = $request->except('_token'); foreach ($settings as $key => $value) { $group = 'general'; if (str_starts_with($key, 'seo_')) $group = 'seo'; if (str_starts_with($key, 'scripts_')) $group = 'scripts'; if (str_starts_with($key, 'company_')) $group = 'company'; if (str_starts_with($key, 'dashboard_')) $group = 'dashboard'; if (str_starts_with($key, 'marketing_')) $group = 'marketing'; Setting::set($key, $value, $group); } // Limpa o cache para garantir que as novas configurações sejam aplicadas Artisan::call('cache:clear'); Artisan::call('view:clear'); return redirect()->back()->with('success', 'Configurações globais atualizadas com sucesso.'); } public function erpAd() { return view('admin.erp.ad'); } }