I have the following models
Member
-id
-full_name
-others...
AllowanceBill
-id
-others...
Payment
-allowance_bill_id
-member_id
-total_amount
-payable_amount
and I'm using this relationship on the AllowanceBill model
public function members(){
return $this->hasManyThrough(
Member::class,
Payment::class,
'allowance_bill_id',
'id',
'id',
'member_id'
);
}
I want to display a table of a specific bill, let's say Bill#2 with this format
Member ID, Full Name, Total Amount, Payable Amount
but using this in show() callback of AllowanceBillController
$allowanceBill->members()->get();
returns all the payments, not just the payments specific to bill#2
Any idea why it's not working?