*/ class PostFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'workspace_id' => Workspace::factory(), 'user_id' => User::factory(), 'content' => '', 'media' => [], 'status' => PostStatus::Draft, ]; } public function draft(): static { return $this->state(fn (array $attributes) => [ 'status' => PostStatus::Draft, ]); } public function scheduled(): static { return $this->state(fn (array $attributes) => [ 'status' => PostStatus::Scheduled, 'scheduled_at' => now()->addDay(), ]); } public function published(): static { return $this->state(fn (array $attributes) => [ 'status' => PostStatus::Published, 'published_at' => now(), ]); } public function failed(): static { return $this->state(fn (array $attributes) => [ 'status' => PostStatus::Failed, ]); } }