fedi-feed-router/backend/database/factories/SettingFactory.php

35 lines
813 B
PHP
Raw Normal View History

2025-08-02 03:48:06 +02:00
<?php
namespace Database\Factories;
use App\Models\Setting;
use Illuminate\Database\Eloquent\Factories\Factory;
class SettingFactory extends Factory
{
protected $model = Setting::class;
public function definition(): array
{
return [
'key' => $this->faker->unique()->slug(2, '_'),
'value' => $this->faker->word(),
'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'updated_at' => now(),
];
}
public function withKey(string $key): static
{
return $this->state(fn (array $attributes) => [
'key' => $key,
]);
}
public function withValue(string $value): static
{
return $this->state(fn (array $attributes) => [
'value' => $value,
]);
}
}