fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => static::$password ??= Hash::make('password'), 'remember_token' => \Illuminate\Support\Str::random(10), 'tenant_id' => Tenant::factory(), ]; } public function withRole(string $roleName): static { return $this->afterCreating(function ($user) use ($roleName) { $role = Role::firstOrCreate(['name' => $roleName]); \DB::table('role_user')->insertOrIgnore([ 'role_id' => $role->id, 'user_id' => $user->id, 'created_at' => now(), 'updated_at' => now(), ]); }); } public function withLicense(License $license): static { return $this->afterCreating(function ($user) use ($license) { \DB::table('license_assignments')->insertOrIgnore([ 'license_id' => $license->id, 'user_id' => $user->id, 'created_at' => now(), 'updated_at' => now(), ]); }); } public function unverified(): static { return $this->state(fn () => ['email_verified_at' => null]); } }