0

How to access the fields in the table in many-to-many intermediate tables?

What kind of eloqunet builder is required to access the isAlternative field in the table named category_product?

Category table

categories
 - id
 - name

Product table

products
 - id
 - name
 - price

CategoryProduct table

category_product
 - category_id
 - product_id
 - isAlternative
Denymeck
  • 1
  • 1
  • 1
    `withPivot('isAlternative')` https://laravel.com/docs/8.x/eloquent-relationships#retrieving-intermediate-table-columns – user3532758 Nov 09 '20 at 14:35
  • what have you tried so far? what error are you getting? – BillJustin Nov 09 '20 at 14:41
  • Does this answer your question? [getting the value of an extra pivot table column laravel](https://stackoverflow.com/questions/26566675/getting-the-value-of-an-extra-pivot-table-column-laravel) – miken32 Nov 09 '20 at 16:13

0 Answers0