/**
  * Lists all UserLinkDev models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new UserLinkDevSearch();
     // https://github.com/yiisoft/yii2/issues/5668
     // зарегистрированный пользователь должен видеть только свои связи
     $searchModel->id_user = Yii::$app->user->identity->id;
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     // validate if there is a editable input saved via AJAX
     if (Yii::$app->request->post('hasEditable')) {
         $model = new UserLinkDev();
         $bookId = Yii::$app->request->post('editableKey');
         $model = UserLinkDev::findOne($bookId);
         $post = [];
         $posted = current($_POST['UserLinkDev']);
         $post['UserLinkDev'] = $posted;
         // Load model like any single model validation
         if ($model->load($post)) {
             // When doing $result = $model->save(); I get a return value of false
             if ($model->save()) {
                 if (isset($posted['dev_name'])) {
                     $output = $model->dev_name;
                 }
                 $out = Json::encode(['output' => $output, 'message' => '']);
             }
         }
         // Return AJAX JSON encoded response and exit
         echo $out;
         return;
     }
     // non-ajax - render the grid by default
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * Lists all StateMap models.
  * @return mixed
  */
 public function actionIndex()
 {
     //if (\Yii::$app->user->isGuest) {
     //   return $this->goHome();
     //}
     $user_link_dev = UserLinkDev::find()->where(['id_user' => Yii::$app->user->identity->id]);
     $user_link_dev->count();
     $searchModel = new UserLinkDevSearch();
     // https://github.com/yiisoft/yii2/issues/5668
     // зарегистрированный пользователь должен видеть только свои связи
     $searchModel->id_user = Yii::$app->user->identity->id;
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     //$searchModel = new StateMapSearch();
     // $searchModel->id_dev = $id_dev; // дописал ЯЯЯ
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['dataProvider' => $dataProvider, 'roma' => $user_link_dev->count()]);
 }