Deploy Ladill POS / deploy (push) Successful in 43s
Wallet-backed Pro unlocks unlimited products, restaurant mode, catalog imports, and ecosystem sync features. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
801 B
PHP
28 lines
801 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Pos\ProSubscription;
|
|
use App\Services\Pos\SubscriptionService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class RenewProSubscriptionsCommand extends Command
|
|
{
|
|
protected $signature = 'pos:pro-renew';
|
|
|
|
protected $description = 'Charge the Ladill wallet for due POS 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;
|
|
}
|
|
}
|