user->id;
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
$id = $result[0]['id'];
if(Yii::$app->user->isGuest) return $this->render('index', ['info' => '
Пожалуйста, авторизируйтесь!
']);
else if($id) {
$dataProvider = new ActiveDataProvider([
'query' => FieldsValueNew::find()
->where(['item_id' => $id, 'item_type' => FieldsValueNew::TYPE_PROFILE])
->orderBy('order'),
'pagination' => [
'pageSize' => 200,
],
]);
$skills = CardSkill::find()->where(['card_id' => $id])->with('skill')->all();
return $this->render('view', [
'model' => $this->findModel($id),
'modelFildValue' => $dataProvider,
'skills' => $skills,
]);
}
else return $this->render('index', ['info' => 'Ваши личные данные не заненсены в базу.
']);
}
/**
* Finds the Product model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return UserCard the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = UserCard::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}