Esempio n. 1
0
 public function getMenuItems($meal_plan_id)
 {
     $food = array();
     $foodjets_menu_id = FoodjetsMealPlan::where("id", "=", $meal_plan_id)->pluck("foodjets_menu_id");
     //$menu_item_id = FoodjetsMenuItems::select("restaurant_menu_item_id")->where("foodjets_menu_id","=",$foodjets_menu_id)->orderBy(DB::raw("Rand()"))->take(2)->get();
     $menu_item_id = FoodjetsMenuItems::select('restaurant_menu_item.name', 'restaurant_menu_item.description', 'restaurant_menu_item.category', 'restaurant_menu_item.image', 'restaurant_menu_item.selling_price', 'restaurant_menu_item.id', 'foodjets_menu_item.id as foodjets_menu_item_id', 'foodjets_menu_item.extra as extra', 'foodjets_menu_item.unlimited as unlimited')->join('restaurant_menu_item', 'restaurant_menu_item.id', '=', 'foodjets_menu_item.restaurant_menu_item_id')->join('restaurant', 'restaurant.id', '=', 'restaurant_menu_item.restaurant_id')->where('foodjets_menu_item.foodjets_menu_id', '=', $foodjets_menu_id)->orderBy('foodjets_menu_item.meal_serial_no', 'asc')->orderBy(DB::raw("Rand()"))->take(2)->get();
     foreach ($menu_item_id as $val) {
         $obj['food_id'] = $val->foodjets_menu_item_id;
         $obj['food_qty'] = 2;
         $food[] = $obj;
     }
     return $food;
 }