$this->faker->firstName(), 'last_name' => $this->faker->lastName(), 'email' => $this->faker->unique()->safeEmail(), 'phone' => $this->faker->phoneNumber(), ]; } public function withClient(?Client $client = null): static { return $this->afterCreating(function (Contact $contact) use ($client) { $contact->clients()->attach( $client ?? Client::factory()->create(), ['is_primary' => true] ); }); } }