I've created a FormRequest to validate some fields, and I would like that one of those fields only accept the options that a I give it
Searching I found something like this
"rule" => 'required|in:Option1,Option2,Option3',
This accept only the predifined options, but in the error message only shows
"The rule type is invalid."
And I would like that too shows the valid options predefined in the rules. How could i do this?
In the end I modified my rule to this:
"rule" => ['required', 'in:Option1,Option2,Option3']
and I customized the error message with the following
public function messages()
{
return [
'rule.in' => 'The rule field must be Option1, Option2 or Option3.'
];
}