I have a table, where the user can fill in information. However, the user can add rows and/or delete rows. I used a cloning function for that.
My html looks like:
<input type="text" class="form-control" name="TB1_a[]">
<input type="text" class="form-control" name="TB1_b[]">
As you can see, it is an array input. So if the user adds a row, I'll have two values stored in TB1_a[] and TB1_b. Now, I would like to make my rules so that if the user enters information inside TB1_a[0], I would like to make TB1_b[0] required, but valid if both TB1_a[0] and TB1_b[0] are empty.
My validation rules:
'TB1_a.*' => 'required_with:TB1_b.*',
'TB1_b.*' => 'required_with:TB1_a.*'
However, these rules are unable to detect that I am referring to an array, meaning Laravel does not detect the '.*'. I would also like to point out that this logic was working perfectly with Laravel 5.4, but I have had to downgrade my Laravel and now it stops working. Any help please?