fedi-feed-router/database/factories/ArticlePublicationFactory.php

35 lines
1 KiB
PHP
Raw Normal View History

2025-08-02 03:48:06 +02:00
<?php
namespace Database\Factories;
use App\Models\ArticlePublication;
use App\Models\Article;
use App\Models\PlatformChannel;
use Illuminate\Database\Eloquent\Factories\Factory;
class ArticlePublicationFactory extends Factory
{
protected $model = ArticlePublication::class;
public function definition(): array
{
return [
'article_id' => Article::factory(),
'platform_channel_id' => PlatformChannel::factory(),
'post_id' => $this->faker->uuid(),
2025-08-10 21:18:20 +02:00
'platform' => 'lemmy',
2025-08-02 03:48:06 +02:00
'published_at' => $this->faker->dateTimeBetween('-1 month', 'now'),
'published_by' => $this->faker->userName(),
2025-08-10 21:18:20 +02:00
'publication_data' => null,
2025-08-02 03:48:06 +02:00
'created_at' => $this->faker->dateTimeBetween('-1 month', 'now'),
'updated_at' => now(),
];
}
public function recentlyPublished(): static
{
return $this->state(fn (array $attributes) => [
'published_at' => $this->faker->dateTimeBetween('-1 day', 'now'),
]);
}
}