'COPYRIGHT'], ['color' => '#24B34C']); $blank = Label::firstOrCreate(['name' => 'BLANK'], ['color' => '#000000']); if (Setting::get('song_prefix_label_id') === null) { Setting::set('song_prefix_label_id', (string) $copyright->id); } if (Setting::get('song_postfix_label_id') === null) { Setting::set('song_postfix_label_id', (string) $blank->id); } $settings = []; foreach (self::AGENDA_KEYS as $key) { $settings[$key] = Setting::get($key); } return Inertia::render('Settings', [ 'settings' => $settings, 'assignments' => MacroAssignment::with(['macro', 'label'])->orderBy('part_type')->orderBy('order')->get(), 'macros' => Macro::with('collections')->orderBy('name')->get(), 'labels' => Label::orderBy('name')->get(), 'collections' => MacroCollection::with('macros')->orderBy('name')->get(), 'last_macros_import' => [ 'at' => Setting::get('macros_last_imported_at'), 'filename' => Setting::get('macros_last_imported_filename'), ], 'last_labels_import' => [ 'at' => Setting::get('labels_last_imported_at'), 'filename' => Setting::get('labels_last_imported_filename'), ], 'export_pro_files' => [ 'prefix' => ExportProFile::prefix()->orderBy('order')->get(['id', 'original_name', 'order']), 'postfix' => ExportProFile::postfix()->orderBy('order')->get(['id', 'original_name', 'order']), ], ]); } public function update(Request $request): JsonResponse { $validated = $request->validate([ 'key' => ['required', 'string', Rule::in(self::AGENDA_KEYS)], 'value' => ['nullable', 'string', 'max:500'], ]); if ($validated['key'] === 'default_translation_language') { validator($validated, [ 'value' => ['nullable', Rule::in(['DE', 'EN', 'FR', 'ES', 'NL', 'IT'])], ])->validate(); } Setting::set($validated['key'], $validated['value']); return response()->json(['success' => true]); } }