I have a Payment and a TransactionsGroup model. They are related via a BelongsToMany relationship.
The TransactionGroup is also related to Transactions via HasMany.
I want to get the Payments and related transactions. How would I do this using Eloquent? I've got this far:
$payments = Payment::with('transactionGroups')->findOrFail($paymentId);
Thanks.