How can I write rule for input field like below:
{!! Form::number("amount[]",null,['min' => 0, 'class' => 'form-control col-xs-2 ']) !!}
I tried following which gave error: htmlentities() expects parameter 1 to be string, array given
$rules = array(
'amount[]' => 'required'
);
$this->validate($request, $rules);
Update:
I tried this as suggested by a user, it's not redirecting it on page again. Below is controller method:
public function postEstimate(Request $request) {
$rules = array(
'amount' => 'required|array'
);
$this->validate($request, $rules);
}
amount[]as array,cant you call the fieldamount?rulesthen yes I already set it asamountbut it's not catching it at all.amount.0inside rules (in case this is your first amount[]) but I don't see why you would want to do it like this.valueKeyall you need to do is iterate once just to build the array of rules for youramountarray. if you dont have an option to delete the dynamic fields you might be able to userangefunction from 0 to array length.