Deploy Ladill Events / deploy (push) Successful in 42s
Cut ticket checkouts off Ladill Pay, settle to merchant gateways at 0% platform fee, and mirror Invoice freemium pricing (GHS 49 / 149). Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
813 B
PHP
28 lines
813 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Events\ProSubscription;
|
|
use App\Services\Events\SubscriptionService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class RenewProSubscriptionsCommand extends Command
|
|
{
|
|
protected $signature = 'events:pro-renew';
|
|
|
|
protected $description = 'Charge the Ladill wallet for due Events Pro subscriptions.';
|
|
|
|
public function handle(SubscriptionService $subscriptions): int
|
|
{
|
|
$due = ProSubscription::where('status', ProSubscription::STATUS_ACTIVE)
|
|
->where('auto_renew', true)
|
|
->where('current_period_end', '<=', now())
|
|
->get();
|
|
|
|
$this->info("Renewing {$due->count()} due subscription(s).");
|
|
$due->each(fn (ProSubscription $sub) => $subscriptions->renewIfDue($sub));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|