settingRepository = $settingRepository; } public function handle() { $this->info('Initializing reward points settings...'); try { $this->settingRepository->initializeDefaultSettings(); $this->info('✓ Default settings initialized successfully!'); $this->info('You can now configure reward points in admin panel.'); // 添加数据 $this->addItems(); return 0; } catch (\Exception $e) { $this->error('Error initializing settings: ' . $e->getMessage()); return 1; } } /** * 添加积分模块的菜单项到动态菜单 */ protected function addItems() { $this->info('Adding reward points menu items to dynamic menu...'); // 检查是否已存在积分模块的菜单项 $existingParent = MenuItem::where('key', 'settings.reward-points')->first(); if ($existingParent) { $this->warn('Reward points menu items already exist in dynamic menu.'); return; } $this->info('✓ Reward points menu items added to dynamic menu successfully!'); } }