Hi Everyone,
Quick question: Is it possible to have (a sort of) belongsToMany association to itself?
I would like to be able to ‘attach’ products to eachother. In the same way as I would ‘attach’ a product to a category.
In a category-situation, I would have a categories_products table and do this:
$this->belongsToMany('Categories', [ 'foreignKey' => 'product_id', 'targetForeignKey' => 'category_id', 'joinTable' => 'categories_products' ]);
But how do I achieve this when I want to have a collection of related products? Or is that not possible at all? (not with associations?). Can someone point me in the right direction? Thanks!
Kind regards,
Elbert