samedi 21 septembre 2019

How to display laravel column values when grouped

I'm Trying to display restaurant Menus grouped by the categories, for example...

  1. Lunch
    • Chicken and Chips
    • Rice
  2. Breakfast
    • Tea
    • Coffee

So I have 3 tables in my database, Restaurants, Categories, And Menus

In my Restaurant Controller i have the following

 $menus=Menu::with(['category_type'])->where('restaurant_id',$restaurant->id)->get()->groupBy('category_id');

return view('frontend.restaurant.show', compact('menus'));

In My Views I need to loop through the $menus I'm stack Help ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire