johnef_sh
6 months ago

Laravel-5.4: validation array field don't recognize (*)

Posted 6 months ago by johnef_sh

I am trying to validates fields like this

{!! Form::text('packages[0][price]', null, ['class'=>'form-control', 'placeholder' => trans('interface.price')]) !!}
{!! Form::text('packages[0][unit_count]', null, ['class'=>'form-control', 'placeholder' => trans('interface.unitCount')]) !!}

when I try to make the validation like this

'packages.0.price' => 'required|regex:/^[\d.,]+$/', it works fine

but with (*)

'packages.*.price' => 'required|regex:/^[\d.,]+$/',

it don't work, any ideas please.

Please sign in or create an account to participate in this conversation.