示例#1
0
文件: Category.php 项目: pham186/yii2
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['category_id' => 'id']);
 }
示例#2
0
 public function actions()
 {
     return ['sort' => ['class' => SortableGridAction::className(), 'modelName' => Post::className()], 'suggest' => ['class' => \sjaakp\taggable\TagSuggestAction::className(), 'tagClass' => Tag::className()]];
 }
示例#3
0
文件: Tag.php 项目: akula22/fifa
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'model_id'])->viaTable('tag_id', ['tag_id' => 'id']);
 }