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

38 lines
No EOL
930 B
PHP

<?php
namespace Database\Factories;
use App\Models\Route;
use App\Models\Feed;
use App\Models\PlatformChannel;
use Illuminate\Database\Eloquent\Factories\Factory;
class RouteFactory extends Factory
{
protected $model = Route::class;
public function definition(): array
{
return [
'feed_id' => Feed::factory(),
'platform_channel_id' => PlatformChannel::factory(),
'is_active' => $this->faker->boolean(80), // 80% chance of being active
'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
'updated_at' => now(),
];
}
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => true,
]);
}
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => false,
]);
}
}