backend/controllers/RestaurantController.php
/**
     * Lists all Restaurant models.
     * @return mixed
     */
Lists all Restaurant models.
@return mixed
Lists all Restaurant models . @return mixed
public function actionIndex()
    {
        $userId = Yii::$app->user->identity->id;
        $dataProvider = new ActiveDataProvider([
            'query' => Restaurant::find()->where("restaurantId = (SELECT restaurantId FROM staff WHERE userId = $userId)"),
        ]);
        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionIndex ( ) { $ userId = Yii :: $ app -> user -> identity -> id ; $ dataProvider = new ActiveDataProvider ( [ 'query' => Restaurant :: find ( ) -> where ( " restaurantId = (SELECT restaurantId FROM staff WHERE userId =  $ userId ) " ) , ] ) ; return $ this -> render ( 'index' , [ 'dataProvider' => $ dataProvider , ] ) ; }
Lists all Restaurant models.
Lists all Restaurant models .