What seems to be the problem:
Docs gives an example with model relation binding using one single model, that is simply binded in a mount() for example
and used as user.posts.*.title
Steps to Reproduce:
Are you using the latest version of Livewire: yes
Do you have any screenshots or code examples:
How to bind relations to a user list. so it would be as
component
public $bills;
protected $rules = [
'bills.*.id' => 'nullable',
'bills.*.name => 'nullable',
'bills.payments.*.amount' => ['required','numeric'],
];
public function render()
{
$this->bills = PaymentBill::with('payment_description','payments')->get();
return view('livewire.admin.payment-list');
}
Blade
@foreach($bills as $index => $bill)
<div wire:key="bill-field-{{ $bill->id }}">
<input wire:model="bills.{{ $index}}.name" > // this is ok, I get the input
</div>
@foreach($bill->payments as $i => payment)
<div wire:key="payment-field-{{ $payment->id }}">
<input wire:model="bills.payments.{{ $i }}.amount"> // cant get input here
</div>
@endforeach
@endforeach
Mostly it is because PaymentBill model is not binded. How to bind model to each iteration of a model list ?
Thank you in advice