Can't add data to a table with belongsToMany relationship

Posted In Voyager
  • hour-ly 1 year ago
    I have a relationship setup between the products and subcategory table. The relationship is belongsToMany using a pivot table called 'product_subcategory' which has two columns are 'product_id' and 'subcategory_id'. 
    Then, when i add  new data to product table it show error 'Unknown Column 'product_subcategory.sub_category_id' in 'on clause'.

    I have a relationship setup between the products and subcategory table. The relationship is belongsToMany using a pivot table called 'product_subcategory' which has two columns are 'product_id' and 'subcategory_id'. Then, when i add new data to product table it show error 'Unknown Column 'product_subcategory.sub_category_id' in 'on clause'.

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
tnylea
Cheers Friend!

I'm Tony, the creator of this site. I'm trying to increase my twitter following. Want to follow me?

Follow @tnylea If not, no worries :)