예제 #1
0
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('posts_categories', ['category_id' => 'id'])->where(['post.status' => 1]);
 }