'Odometer', '/map' => 'MapLocation', '/courses' => 'Notebook', '/activities' => 'Calendar', '/news' => 'Reading', '/teachers' => 'Avatar', '/students' => 'Postcard', '/demands' => 'ChatLineRound', '/crawler' => 'Download', '/papers' => 'Document', '/universities' => 'School', '/banners' => 'Picture', '/system/users' => 'User', '/system/roles' => 'Key', '/system/menus' => 'Menu', '/system/dict' => 'Notebook', '/system/audit-logs' => 'Tickets', '/system/research-directions' => 'Collection', '/system/grid-members' => 'Coordinate', ]; foreach ($icons as $path => $icon) { $count = Menu::query()->where('path', $path)->update(['icon' => $icon]); if ($count > 0) { $this->command?->info("{$path} → {$icon}"); } } // 兜底:所有可见子菜单若仍无图标,使用 Menu Menu::query() ->whereNotNull('parent_id') ->where('status', 1) ->where(function ($q) { $q->whereNull('icon')->orWhere('icon', ''); }) ->update(['icon' => 'Menu']); $this->command?->info('子菜单图标已更新。'); } }