I have problem with eloquent query. I am using one to Many Relationship to get 'MenuItems' With the 'Menu'. I want to get all menuItems of a particular menu in sorted by 'sort_order' field Using the code below:
Menu::where('slug', 'main-navigation')->with('MenuItems')->orderBy('MenuItems.sort_order', 'asc')->get();
It is not working, is it possible to do it with eloquent? If yes then how?