public function actionAvatar() { $profile = $this->findProfile(); $avatars = Avatar::find()->all(); if ($profile->load(Yii::$app->request->post()) && $profile->save()) { Yii::$app->session->setFlash('success', 'Аватар успешно изменен'); return $this->redirect(['index']); } return $this->render('avatar', ['current' => $profile, 'avatars' => $avatars]); }
/** * Lists all Avatar models. * @return mixed */ public function actionIndex() { //$searchModel = new AvatarSearch(); $dataProvider = new ActiveDataProvider(['query' => Avatar::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }