With a union you will probably be better off using the query Builder.
Apr 27, 2016
3
Level 1
Eloquent: belongsToMany with union
Hi,
consider the following simplified datamodel:
A product can contain many options. An option belongs to many products.
3 tables: Products, Options and Product_Options
However, there is an attribute "linked_with_all_products" (true/false) on the Options table, when checked, the option is linked with all products and no records are inserted in Product_Options.
Simple question: what is the correct way to retrieve all the options linked with a certain product?
(I'm new to eloquent and laravel)
Thanks in advance,
Koen
Please or to participate in this conversation.