Пример #1
0
 public function acProblem()
 {
     $cid = '16';
     $posts = Post::find()->where(['category_id' => $cid])->limit(10)->orderBy('id desc')->all();
     return $this->view('problem', ['posts' => $posts]);
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPost()
 {
     return $this->hasMany(Post::className(), ['category_id' => 'id']);
 }