Tenant::factory(), 'name' => $this->faker->randomElement($categories), 'description' => $this->faker->sentence(), 'is_default' => $this->faker->boolean(20), 'position' => $this->faker->numberBetween(1, 10), ]; } public function withTasks(int $count = 3): static { return $this->afterCreating(function (TaskCollection $collection) use ($count) { \App\Models\Task::factory($count) ->create(['tenant_id' => $collection->tenant_id]) ->each(function ($task) use ($collection) { $task->taskCollection()->associate($collection); $task->save(); }); }); } public function default(): static { return $this->state(fn (array $attributes) => [ 'is_default' => true, 'position' => 1, ]); } }