In online store there is a table of categories(categories),
sub-categories(subcategories) with a field category_id,
and table products with a field subcategory_id.
Each subset necessarily belongs to one category. Each product in the same category.
Get all products of a particular Subcategory, you can:
$products = Product::where('subcategory_id','=', $subcategory_id)->get();
Subcategories from a specific category:
$subcategories = Subcategory::where('category_id','=', $category_id)->get();
Question - how to select all products from a specific category? The project training.