argument('platform'); if ($platform === 'lemmy') { return $this->syncLemmy(); } $this->error("Unsupported platform: {$platform}"); return self::FAILURE; } private function syncLemmy(): int { $communityName = config('lemmy.community'); if (!$communityName) { $this->error('Missing Lemmy community configuration (lemmy.community)'); return self::FAILURE; } try { $this->info("Getting community ID for: {$communityName}"); $api = new LemmyApiService(config('lemmy.instance')); $communityId = $api->getCommunityId($communityName); $this->info("Running sync job for Lemmy community: {$communityName} (ID: {$communityId})"); SyncChannelPostsJob::dispatchSync( PlatformEnum::LEMMY, (string) $communityId, $communityName ); $this->info('Channel posts synced successfully'); return self::SUCCESS; } catch (\Exception $e) { $this->error("Failed to sync channel posts: {$e->getMessage()}"); return self::FAILURE; } } }