info('Starting permissions refresh...'); try { // Run the Permission seeder $this->info('Running Permission seeder...'); Permission::truncate(); $this->permissionSeeder->run(); $this->info('Permission seeder completed successfully.'); // Run the UserTypePermission seeder $this->info('Running UserTypePermission seeder...'); UserTypePermission::truncate(); $this->userTypePermissionSeeder->run(); $this->info('UserTypePermission seeder completed successfully.'); // Clear cache foreach (UserTypeEnum::toArray() as $type) { Cache::forget("permissions_role_{$type}"); } Cache::forget("permissions_guest"); $this->info('Permissions refresh completed successfully!'); return Command::SUCCESS; } catch (\Exception $e) { $this->error('An error occurred while refreshing permissions:'); $this->error($e); return Command::FAILURE; } } }