File size: 965 Bytes
74acf19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?php
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;
}
}
|