public function actionTag($slug) { $tag = Tag::findOne(["name" => $slug]); $posts = new ActiveDataProvider(["query" => $tag->getPosts()->where(["status" => 1])->orderBy(["created_at" => SORT_DESC]), 'sort' => false, "pagination" => ["defaultPageSize" => 5]]); // \Yii::$app->VarDumper->dump(); die(); // $tags = \app\modules\post\models\Tag::find()->with('post')->all(); // \Yii::$app->VarDumper->dump($tags); die(); // $dataProvider = new ActiveDataProvider([ // 'query' => \app\modules\post\models\Tag::find()->with('post'), // 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]], // 'pagination' => [ // 'pageSize' => 10 // ], // ]); return $this->render('index', ['dataProvider' => $posts]); }