35 lines
No EOL
813 B
PHP
35 lines
No EOL
813 B
PHP
<?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,
|
|
]);
|
|
}
|
|
} |