I've a simple array of rules in rules function:
return [
'anumber' => 'required|numeric'
];
And I fill this in getValidatorInstance method this way:
request()->merge(['anumber' => IdsCompany::getNumDBempty()]);
By the way, getNumDBempty() is working as expected, and returns an int or 'false', I want the validator only accept the request if the function returns a number.
The thing is that 'anumber' is merged with the request but it keeps telling me that 'anumber' is compulsory.
I've fighting and searching for a couple of days, and I don't find any clue of why the validator don't work on variables merged in getValidatorInstance(). (I've tried to validate this in others FormRequest and the result is the same, they ignore it like the variable was never there, but the request has it inside.)
Working in Laravel 5.5 atm, and planning to upgrade 5.6 when my form request are done and working.
Thank you all in advance! Have a good Thursday!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire