Certified/app/Console/Commands/SyncSubscriptions.php
2026-08-09 16:33:53 +02:00

22 lines
673 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\Billing\SubscriptionManager;
use Illuminate\Console\Command;
class SyncSubscriptions extends Command
{
protected $signature = 'app:sync-subscriptions';
protected $description = 'Safety-net sweep for subscription billing: flag overdue invoices as past due, and downgrade lapsed/cancelled subscriptions to Free';
public function handle(SubscriptionManager $subscriptions): int
{
$result = $subscriptions->syncSubscriptions();
$this->info("Marked {$result['pastDue']} subscription(s) past due and downgraded {$result['downgraded']} to Free.");
return self::SUCCESS;
}
}