How to use compare validators in resource ?
With dashboard it's works but not in resource
Please find my code :
Number::create("min_duration")
->label($this->tr->trad('min_duration'))
->searchable(true)
->sortable(true)
->showOnIndex(false)
->showOnCreate(true)
->showOnUpdate(true)
->inputWidget(
TextBox::create("min_duration")
)
->validators([
NumericValidator::create(),
]),
Number::create("max_duration")
->label($this->tr->trad('max_duration'))
->searchable(true)
->sortable(true)
->showOnIndex(false)
->showOnCreate(true)
->showOnUpdate(true)
->inputWidget(
TextBox::create("max_duration")
)
->validators([
NumericValidator::create(),
CompareValidator::create()
->inputToValidate("min_duration")
->inputToCompare("min_duration") // Compare with min_duration field
->errorMessage("Max duration should be equal to min duration")
->operator("=") // Compare for equality
Thanks