I can't figure out how to delete my entries from a 'link table'. For example i have a product that can link to multiple categories. I have a table called 'product', 'category' and 'product_in_category'
And i linked all the models with hasmanytomany for the product and category and belongs to for the product_in_category.
To get all these categories we can do:
to add multiple categories i can do
$product->categories = array(category object, category object)
But how do i delete categories from a product? If I do
$product->getCategories()->delete() it looks like it tries to delete the category itself but it should only remove the link between te category and the product.
What is the way to go here? I can't find anything about this in the documentation.