Open
Description
I'm doing
$product = Product::where('sku', '0713XX3FF1')->where('store_id', 1)->first();
$category = Category::where('entity_id', 158)->first();
$product->categories()->attach( $category );
And this is saving the related ids on both collections, so if I have 1 category, with 10000 products, the category has an array of 10000 products inside.
What's the reason?
Saving the category inside the product will do the job, or I'm losing something?