*/ final class PageFactory extends Factory { protected $model = Page::class; public function definition(): array { $title = $this->faker->sentence(4); return [ 'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(1, 99999), 'title' => $title, 'body' => '

' . implode('

', $this->faker->paragraphs(2)) . '

', 'layout' => 'default', 'meta_title' => null, 'meta_description' => null, 'is_published' => true, 'published_at' => $this->faker->dateTimeBetween('-1 year', 'now'), ]; } public function draft(): static { return $this->state(['is_published' => false, 'published_at' => null]); } }