return [
'contract_code' => 'required',
'name' => 'required|string',
'abbreviation' => 'required|string',
'linecount_divisor' => 'required|integer'
];
// into input fields => 'required'
How to shorten the validation rule in multiple inputs?
return [
'contract_code' => 'required',
'name' => 'required|string',
'abbreviation' => 'required|string',
'linecount_divisor' => 'required|integer'
];
// into input fields => 'required'
How to shorten the validation rule in multiple inputs?
3
Answers
if You have the same validation rule for multiple and you want to shorten your code just use form requests.
And then in the controller Functions use it
don’t forget to use that request class.
Here is a solution assuming all input fields need to have a common rule like required.
Try this one in Laravel