| namespace App\Console\Commands; | |
| use App\Services\SocialRecurringCampaignService; | |
| use Illuminate\Console\Command; | |
| class EnqueueRecurringSocialPosts extends Command | |
| { | |
| protected $signature = 'social:enqueue-recurring {--limit=30 : Jumlah campaign yang diproses per run} {--window=60 : Window menit ke depan untuk mengisi queue}'; | |
| protected $description = 'Membuat queue post baru dari campaign social yang berulang.'; | |
| public function handle(SocialRecurringCampaignService $recurringCampaigns): int | |
| { | |
| $processed = $recurringCampaigns->enqueueDueCampaigns( | |
| (int) $this->option('limit'), | |
| (int) $this->option('window') | |
| ); | |
| if ($processed === 0) { | |
| $this->info('Tidak ada recurring campaign yang perlu mengisi queue.'); | |
| return self::SUCCESS; | |
| } | |
| $this->info("Recurring queue generated: {$processed} campaign diproses."); | |
| return self::SUCCESS; | |
| } | |
| } | |