When I simplified:
$category = Magazine_subcategory::with('products')->where('name',$subkategoria)->firstOrFail();
return $category;
Error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projekt_pelka.magazine_subcategory_product' doesn't exist (SQL: select products.*, magazine_subcategory_product.magazine_subcategory_id as pivot_magazine_subcategory_id, magazine_subcategory_product.product_id as pivot_product_id from products inner join magazine_subcategory_product on products.id = magazine_subcategory_product.product_id where magazine_subcategory_product.magazine_subcategory_id in (1))
What is this caused?