Files
ladill-pos/app/Console/Commands/RenewProSubscriptionsCommand.php
T
isaaccladandCursor f800f0c1ca
Deploy Ladill POS / deploy (push) Successful in 43s
Add POS Pro subscription billing and free-tier limits.
Wallet-backed Pro unlocks unlimited products, restaurant mode, catalog imports, and ecosystem sync features.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 00:51:35 +00:00

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;
}
}