1 | <?php |
||
7 | class Category extends \Eloquent |
||
8 | { |
||
9 | protected $table = 'demo_categories'; |
||
10 | |||
11 | public function articles() |
||
12 | { |
||
13 | return $this->belongsToMany('\Tacone\Bees\Demo\Models\Article', 'demo_article_category', 'category_id', 'article_id'); |
||
14 | } |
||
15 | |||
16 | public function parent() |
||
17 | { |
||
18 | return $this->belongsTo('\Tacone\Bees\Demo\Models\Category', 'parent_id'); |
||
19 | } |
||
20 | |||
21 | public function childrens() |
||
22 | { |
||
23 | return $this->hasMany('\Tacone\Bees\Demo\Models\Category', 'parent_id'); |
||
24 | } |
||
25 | } |
||
26 |