public function actionFavorite($id) { $this->layout = '//u'; $user = User::findOne($id); \Yii::$app->view->params['model'] = $user; $dataProvider = new ActiveDataProvider(['query' => Collection::find()->where(['author_id' => $id])]); $totalCount = $dataProvider->getTotalCount(); $pages = new Pagination(['totalCount' => $totalCount]); return $this->render('favorites', ['models' => $dataProvider->getModels(), 'pages' => $pages, 'author' => $user]); }
public function actionAddFav() { $collections = Collection::find()->where(['author_id' => Yii::$app->user->id])->all(); return $this->renderAjax('addFav', ['collections' => $collections]); }