I am using voyager to create an admin panel for my web app: When I tried to create pivote table with belongsToMany relationship.
I got this error message:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tour_category.tour_category_id' in 'where clause' (SQL: select
tours
.id
fromtours
inner jointour_category
ontours
.id
=tour_category
.tour_id
wheretour_category
.tour_category_id
is null). I'm newbie in using Voyager. Is there anybody that can help me to fix this error?
If someone came here to find a solution, this is how I solved it:
Let's say that you have 2 tables: Customers and Companies.
Before you try to make a belongsToMany relationship, you need to create a pivot table called company_customer including this fields:
company_id (needs to BIGINT, UNSIGNED and INDEX) customer_id (needs to BIGINT, UNSIGNED and INDEX)
Then you can create a relationship between those models and select company_customer as pivot table