backend/controllers/StaffController.php
/**
     * Lists all Staff models.
     * @return mixed
     */
Lists all Staff models.
@return mixed
Lists all Staff models . @return mixed
public function actionIndex()
    {
        $userId = Yii::$app->user->identity->id;
        $restaurantId = (Staff::find()->where(['userId' => $userId])->one())->restaurantId;
        $searchModel = new StaffSearch();
        $dataProvider = new ActiveDataProvider([
            'query' => Staff::find()->where(['restaurantId' => $restaurantId]),
        ]);
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionIndex ( ) { $ userId = Yii :: $ app -> user -> identity -> id ; $ restaurantId = ( Staff :: find ( ) -> where ( [ 'userId' => $ userId ] ) -> one ( ) ) -> restaurantId ; $ searchModel = new StaffSearch ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => Staff :: find ( ) -> where ( [ 'restaurantId' => $ restaurantId ] ) , ] ) ; return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; }
Lists all Staff models.
Lists all Staff models .