Access value from relationship table with AR

Hello all,

as it’s my first post, I want to say I’m very happy with this framework, I have already done one simple web application and now I’m working on a second, more complicated. And of course some questions appeared…

So, for example I have two models - Invoice and Product. They have many to many relationship and in the relationship table there is "quantity" column except the invoice_id and product_id columns.

As I can access all products of a invoice with $invoice->products, is it possible to have the quantity field attached to every product row with AR?

Thanks,

Ivo

You can add a relation items, and invoice has many items.

So you can access to the items with $invoice->items, the quantity like $invoice->items[$i]->quantity and the product with $invoice->items[$i]->product