*/ class UserFactory extends Factory { protected static ?string $password; public function definition(): array { $firstName = fake()->firstName(); $lastName = fake()->lastName(); return [ 'first_name' => $firstName, 'last_name' => $lastName, 'name' => "{$firstName} {$lastName}", 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => static::$password ??= Hash::make('password'), 'remember_token' => Str::random(10), 'job_title' => fake()->jobTitle(), 'department' => fake()->randomElement(['Verwaltung', 'Pflege', 'IT', 'Personal', 'Buchhaltung', 'Technik']), 'location' => fake()->city(), 'phone' => fake()->phoneNumber(), 'is_admin' => false, 'is_active' => true, ]; } public function admin(): static { return $this->state(fn () => ['is_admin' => true]); } public function inactive(): static { return $this->state(fn () => ['is_active' => false]); } public function unverified(): static { return $this->state(fn () => ['email_verified_at' => null]); } }