<?php
 namespace App\Console\Commands; use App\Services\AffiliateService; use Illuminate\Console\Command; class ProcessPendingAffiliateCommissionsCommand extends Command { protected $signature = 'affiliates:process-commissions'; protected $description = 'Process pending affiliate commissions that have passed the delay period'; public function handle(AffiliateService $service): int { $this->info('Processing pending affiliate commissions...'); try { $count = $service->processApprovedCommissions(); $this->info("Processed {$count} commission(s)."); return Command::SUCCESS; } catch (\Exception $e) { $this->error("Failed to process commissions: {$e->getMessage()}"); return Command::FAILURE; } } } 