I need a request validation rule to return a custom message upon failure, and since the field being validating is an array with a min:x
rule i'd like to have a custom message for both singular and plural variations.
I'm just wondering how to pass to the trans_choice()
function the :min
parameter from the validation rule:
Translation file:
'array' => [
'field' => [
'min' => 'You need to select at least one item.|you need to select at least :min items',
],
],
Request message()
method:
public function messages() {
'my.array.field.min' => trans_choice('translations::array.field.min', ???),
}