Tenant::factory(), 'title' => $this->faker->sentence(4), 'description' => $this->faker->paragraph(), 'due_date' => $this->faker->dateTimeBetween('now', '+1 month'), 'is_completed' => $this->faker->boolean(20), // 20% chance completed 'collection_id' => null, ]; } public function completed(): static { return $this->state(fn (array $attributes) => [ 'is_completed' => true, 'completed_at' => now(), ]); } public function urgent(): static { return $this->state(fn (array $attributes) => [ 'priority' => 'urgent', 'due_date' => $this->faker->dateTimeBetween('now', '+3 days'), ]); } public function withCollection(): static { return $this->state(fn (array $attributes) => [ 'collection_id' => TaskCollection::factory(), ]); } public function assignedToEvent(): static { return $this->afterCreating(function (Task $task) { $event = \App\Models\Event::factory()->create(['tenant_id' => $task->tenant_id]); $task->assignedEvents()->attach($event); }); } }