fedi-feed-router/database/factories/KeywordFactory.php
2025-08-02 03:48:06 +02:00

35 lines
No EOL
827 B
PHP

<?php
namespace Database\Factories;
use App\Models\Keyword;
use Illuminate\Database\Eloquent\Factories\Factory;
class KeywordFactory extends Factory
{
protected $model = Keyword::class;
public function definition(): array
{
return [
'keyword' => $this->faker->word(),
'is_blocked' => $this->faker->boolean(30), // 30% chance of being blocked
'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'updated_at' => now(),
];
}
public function blocked(): static
{
return $this->state(fn (array $attributes) => [
'is_blocked' => true,
]);
}
public function allowed(): static
{
return $this->state(fn (array $attributes) => [
'is_blocked' => false,
]);
}
}