ORIENT/plugins/rainlab/blog/models/CategoryGroup.php

48 lines
999 B
PHP

<?php namespace RainLab\Blog\Models;
use Model;
/**
* Model
*/
class CategoryGroup extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'rainlab_blog_category_group';
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
public $translatable = [
'name',
];
public $belongsToMany = [
'category_items' => [
'RainLab\Blog\Models\Category',
'table' => 'rainlab_blog_category_pivot',
'pivot' => ['id', 'category_id', 'order']
],
];
public $hasMany = [
'post' => [
'RainLab\Blog\Models\Post',
'key' => 'post_id'
],
'categoryGroupPivot' => [
'RainLab\Blog\Models\PostCategoryGroupPivot',
'key' => 'category_group_id'
]
];
/**
* @var array Validation rules
*/
public $rules = [
];
}