argument('cityId'); // Find the city $city = City::find($cityId); if (!$city) { $this->error("City with ID {$cityId} not found."); return Command::FAILURE; } $this->info("Refreshing attractions for {$city->name}, {$city->country}..."); if (!$city->latitude || !$city->longitude) { $this->error("City coordinates not set. Cannot fetch attractions."); return Command::FAILURE; } try { // Clear cache for this city's coordinates $this->info("Clearing cached data..."); $openTripMapService->clearCache($city->latitude, $city->longitude); $overpassService->clearCache($city->latitude, $city->longitude); // Delete existing attractions for this city $deletedCount = $city->attractions()->delete(); $this->info("Deleted {$deletedCount} existing attractions."); // Dispatch job to fetch new attractions $this->info("Fetching fresh attraction data..."); FetchAttractionsJob::dispatch($city, true); $this->info("Attractions refresh job dispatched successfully."); $this->comment("The job will process in the background. Check logs for completion status."); return Command::SUCCESS; } catch (\Exception $e) { $this->error("Error refreshing attractions: " . $e->getMessage()); return Command::FAILURE; } } }