*/ class JournalistFactory extends Factory { protected $model = Journalist::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'partner_media_id' => PartnerMedia::factory(), 'name' => $this->faker->name(), 'email' => $this->faker->unique()->safeEmail(), 'phone_number' => $this->faker->phoneNumber(), 'press_card' => $this->faker->optional(0.8)->numerify('PWI-####-########'), 'ukw_certificate' => $this->faker->optional(0.6)->numerify('UKW-####-########'), ]; } /** * Indicate that the journalist has press credentials. */ public function withCredentials(): static { return $this->state(fn (array $attributes) => [ 'press_card' => $this->faker->numerify('PWI-####-########'), 'ukw_certificate' => $this->faker->numerify('UKW-####-########'), ]); } /** * Indicate that the journalist has no credentials. */ public function withoutCredentials(): static { return $this->state(fn (array $attributes) => [ 'press_card' => null, 'ukw_certificate' => null, ]); } }