35 lines
827 B
PHP
35 lines
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,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|