diff --git a/database/migrations/2026_04_28_220700_add_common_settings_defaults.php b/database/migrations/2026_04_28_220700_add_common_settings_defaults.php new file mode 100644 index 0000000..72858bf --- /dev/null +++ b/database/migrations/2026_04_28_220700_add_common_settings_defaults.php @@ -0,0 +1,67 @@ + 'Citrus CMS', + 'project_name_ru' => '', + 'project_number' => '', + 'company_code' => '', + 'row_count' => '20', + 'summary_mails' => '', + 'cron_job_batch_process_count' => '10', + 'cron_job_period' => '1', + 'gemini_api_key' => '', + 'header_color' => 'bg-primary-dark', + 'DevExpress_Theme' => 'dx.material.orange.light.compact.css', + 'pdf_template_path' => 'default', + ]; + + foreach ($settings as $key => $value) { + // Check if setting already exists + $exists = DB::table('settings')->where('title', $key)->exists(); + + if (!$exists) { + DB::table('settings')->insert([ + 'title' => $key, + 'html' => $value, + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $keys = [ + 'project_name', + 'project_name_ru', + 'project_number', + 'company_code', + 'row_count', + 'summary_mails', + 'cron_job_batch_process_count', + 'cron_job_period', + 'gemini_api_key', + 'header_color', + 'DevExpress_Theme', + 'pdf_template_path', + 'handover_control_count', + ]; + + DB::table('settings')->whereIn('title', $keys)->delete(); + } +};