Files
fotospiel-app/database/seeders/GiftVoucherTierSeeder.php
Codex Agent 10c99de1e2
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Migrate billing from Paddle to Lemon Squeezy
2026-02-03 10:59:54 +01:00

34 lines
899 B
PHP

<?php
namespace Database\Seeders;
use App\Services\LemonSqueezy\LemonSqueezyGiftVoucherCatalogService;
use Illuminate\Database\Seeder;
class GiftVoucherTierSeeder extends Seeder
{
public function __construct(private readonly LemonSqueezyGiftVoucherCatalogService $catalog) {}
public function run(): void
{
if (! config('lemonsqueezy.api_key')) {
$this->command?->warn('Skipping gift voucher Lemon Squeezy sync: lemonsqueezy.api_key not configured.');
return;
}
$tiers = config('gift-vouchers.tiers', []);
foreach ($tiers as $tier) {
$result = $this->catalog->ensureTier($tier);
$this->command?->info(sprintf(
'%s → product %s, variant %s',
$tier['key'],
$result['product_id'],
$result['variant_id']
));
}
}
}