*/ class FeedFactory extends Factory { protected $model = Feed::class; public function definition(): array { return [ 'name' => $this->faker->words(3, true), 'url' => $this->faker->url(), 'type' => $this->faker->randomElement(['website', 'rss']), 'language_id' => Language::factory(), 'description' => $this->faker->optional()->sentence(), 'settings' => [], 'is_active' => true, 'last_fetched_at' => null, ]; } public function inactive(): static { return $this->state(fn (array $attributes) => [ 'is_active' => false, ]); } public function website(): static { return $this->state(fn (array $attributes) => [ 'type' => 'website', ]); } public function rss(): static { return $this->state(fn (array $attributes) => [ 'type' => 'rss', ]); } public function recentlyFetched(): static { return $this->state(fn (array $attributes) => [ 'last_fetched_at' => now()->subHour(), ]); } }