33 lines
No EOL
980 B
PHP
33 lines
No EOL
980 B
PHP
<?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(),
|
|
'published_at' => $this->faker->dateTimeBetween('-1 month', 'now'),
|
|
'published_by' => $this->faker->userName(),
|
|
'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'),
|
|
]);
|
|
}
|
|
} |