Esempio n. 1
0
 /**
  * @Get("/food")
  * @Middleware("admin")
  *
  * Returns number of orders for each food for the specified week
  * 
  */
 public function getFoodOrdersForWeek()
 {
     $week = \Input::get('week');
     $orderedFood = [];
     Food::all()->each(function ($food) use($week, &$orderedFood) {
         $arrayFood = $food->toArray();
         $arrayFood['num_orders'] = Menu::getNumOrdersForWeekAndFood($week, $food);
         $orderedFood[] = $arrayFood;
     });
     return $orderedFood;
 }
Esempio n. 2
0
 /**
  * @Get("/")
  * @Middleware("user")
  *
  * Show all foods
  * 
  */
 public function getIndex()
 {
     $food = Food::all();
     return $food;
 }