presseportale/database/factories/PaymentOptionFactory.php
Kevin Adametz 5b8bdf4182
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
12-05-2026 Frontend dev
2026-05-12 18:32:33 +02:00

37 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\PaymentOptionType;
use App\Models\PaymentOption;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<PaymentOption>
*/
class PaymentOptionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$type = fake()->randomElement(PaymentOptionType::cases())->value;
$interval = $type === PaymentOptionType::Onetime->value
? 'once'
: fake()->randomElement(['monthly', 'yearly']);
return [
'article_number' => 'ART-'.fake()->unique()->numerify('#####'),
'type' => $type,
'price_cents' => fake()->numberBetween(990, 49900),
'currency' => 'EUR',
'interval' => $interval,
'is_hidden' => false,
'stripe_product_id' => 'prod_'.fake()->regexify('[A-Za-z0-9]{14}'),
'stripe_price_id' => 'price_'.fake()->regexify('[A-Za-z0-9]{14}'),
];
}
}