78 lines
2.9 KiB
PHP
78 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Enums\PaymentOptionType;
|
|
use App\Models\PaymentOption;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class PaymentOptionSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$options = [
|
|
[
|
|
'article_number' => 'PR-MONTHLY-001',
|
|
'type' => PaymentOptionType::Recurring->value,
|
|
'price_cents' => 4900,
|
|
'currency' => 'EUR',
|
|
'interval' => 'monthly',
|
|
'is_hidden' => false,
|
|
'stripe_product_id' => 'prod_placeholder_monthly',
|
|
'stripe_price_id' => 'price_placeholder_monthly',
|
|
'translations' => [
|
|
'de' => ['name' => 'Monatspaket', 'description' => 'Monatliche Veroeffentlichungen'],
|
|
'en' => ['name' => 'Monthly package', 'description' => 'Monthly publication package'],
|
|
],
|
|
],
|
|
[
|
|
'article_number' => 'PR-YEARLY-001',
|
|
'type' => PaymentOptionType::Recurring->value,
|
|
'price_cents' => 49900,
|
|
'currency' => 'EUR',
|
|
'interval' => 'yearly',
|
|
'is_hidden' => false,
|
|
'stripe_product_id' => 'prod_placeholder_yearly',
|
|
'stripe_price_id' => 'price_placeholder_yearly',
|
|
'translations' => [
|
|
'de' => ['name' => 'Jahrespaket', 'description' => 'Jaehrliche Veroeffentlichungen'],
|
|
'en' => ['name' => 'Yearly package', 'description' => 'Yearly publication package'],
|
|
],
|
|
],
|
|
[
|
|
'article_number' => 'PR-BOOST-ONCE-001',
|
|
'type' => PaymentOptionType::Onetime->value,
|
|
'price_cents' => 9900,
|
|
'currency' => 'EUR',
|
|
'interval' => 'once',
|
|
'is_hidden' => false,
|
|
'stripe_product_id' => 'prod_placeholder_onetime',
|
|
'stripe_price_id' => 'price_placeholder_onetime',
|
|
'translations' => [
|
|
'de' => ['name' => 'Reichweiten-Boost', 'description' => 'Einmaliger Promotion-Boost'],
|
|
'en' => ['name' => 'Reach boost', 'description' => 'One-time promotion boost'],
|
|
],
|
|
],
|
|
];
|
|
|
|
foreach ($options as $optionData) {
|
|
$translations = $optionData['translations'];
|
|
unset($optionData['translations']);
|
|
|
|
$option = PaymentOption::updateOrCreate(
|
|
['article_number' => $optionData['article_number']],
|
|
$optionData
|
|
);
|
|
|
|
foreach ($translations as $locale => $translation) {
|
|
$option->translations()->updateOrCreate(
|
|
['locale' => $locale],
|
|
$translation
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|