validate([ 'phone' => 'nullable|string|max:30', 'email' => 'nullable|email|max:100', 'telegram' => 'nullable|url|max:255', 'youtube' => 'nullable|url|max:255', 'vk' => 'nullable|url|max:255', 'footer_slogan' => 'nullable|string|max:255', 'copyright' => 'nullable|string|max:255', 'working_hours' => 'nullable|string|max:500', // Аналитика 'yandex_metrika' => 'nullable|digits_between:6,12', 'google_analytics' => 'nullable|string|max:30', // Open Graph 'og_site_name' => 'nullable|string|max:100', 'og_description' => 'nullable|string|max:300', 'og_locale' => 'nullable|string|max:10', // Режим сайта 'site_maintenance' => 'nullable|in:0,1', 'site_noindex' => 'nullable|in:0,1', // Файлы 'logo_header' => 'nullable|image|mimes:png,jpg,svg,webp|max:512', 'logo_footer' => 'nullable|image|mimes:png,jpg,svg,webp|max:512', 'og_image' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:2048', ]); // Сохраняем текстовые поля foreach (self::TEXT_KEYS as $key) { Setting::set($key, $request->input($key)); } // Загружаем логотипы — заменяем файл и сохраняем путь в settings foreach (self::LOGO_KEYS as $key) { if ($request->hasFile($key) && $request->file($key)->isValid()) { $ext = $request->file($key)->getClientOriginalExtension(); $filename = $key.'.'.$ext; $request->file($key)->move(public_path('images/logos'), $filename); Setting::set($key, 'images/logos/'.$filename); } } // OG-изображение: 1200×630, сохраняется в public/images/og/ if ($request->hasFile('og_image') && $request->file('og_image')->isValid()) { $ext = $request->file('og_image')->getClientOriginalExtension(); $request->file('og_image')->move(public_path('images/og'), 'og_image.'.$ext); Setting::set('og_image', 'images/og/og_image.'.$ext); } return redirect()->route('admin.settings.index') ->with('success', 'Настройки сохранены.'); } }