Skip to content

differentFrom()

Use differentFrom() when two fields must not contain the same value.

ValidationRegistry::register(
Profile::class,
static fn (RuleSet $rules): array => [
$rules->string('newUsername')->differentFrom('currentUsername'),
]
);

The failure code is different_from.