backend/controllers/OrderController.php
/**
     * Lists all Orders models.
     * @return mixed
     */
Lists all Orders models.
@return mixed
Lists all Orders models . @return mixed
public function actionIndex()
    {
        $userId = Yii::$app->user->identity->id;
        $dataProvider = new ActiveDataProvider([
            'query' => Orders::findBySql("SELECT orders.orderId, orders.date, userId FROM foodly.orders INNER JOIN order_items ON orders.orderId = order_items.orderId WHERE dishId IN (SELECT dishId FROM dishes WHERE menuId in (SELECT menuId FROM menus WHERE restaurantId = (SELECT restaurantId FROM staff WHERE userId = $userId))) group by orderId"),
        ]);
        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionIndex ( ) { $ userId = Yii :: $ app -> user -> identity -> id ; $ dataProvider = new ActiveDataProvider ( [ 'query' => Orders :: findBySql ( " SELECT orders.orderId, orders.date, userId FROM foodly.orders INNER JOIN order_items ON orders.orderId = order_items.orderId WHERE dishId IN (SELECT dishId FROM dishes WHERE menuId in (SELECT menuId FROM menus WHERE restaurantId = (SELECT restaurantId FROM staff WHERE userId =  $ userId ))) group by orderId " ) , ] ) ; return $ this -> render ( 'index' , [ 'dataProvider' => $ dataProvider , ] ) ; }
Lists all Orders models.
Lists all Orders models .