|
1 | | -<?php namespace Trexology\Taxonomy\Models; |
| 1 | +<?php |
2 | 2 |
|
3 | | -class Term extends \Eloquent { |
| 3 | +namespace Trexology\Taxonomy\Models; |
4 | 4 |
|
5 | | - protected $guarded =[ |
6 | | - 'id', |
7 | | - 'created_at', |
8 | | - 'updated_at' |
9 | | - ]; |
| 5 | +class Term extends \Eloquent |
| 6 | +{ |
| 7 | + protected $guarded = [ |
| 8 | + 'id', |
| 9 | + 'created_at', |
| 10 | + 'updated_at', |
| 11 | + ]; |
10 | 12 |
|
11 | | - public static $rules = [ |
12 | | - 'name' => 'required' |
13 | | - ]; |
| 13 | + public static $rules = [ |
| 14 | + 'name' => 'required', |
| 15 | + ]; |
14 | 16 |
|
15 | | - public function termRelation() { |
16 | | - return $this->morphMany('Trexology\Taxonomy\Models\TermRelation', 'relationable'); |
17 | | - } |
| 17 | + public function termRelation() |
| 18 | + { |
| 19 | + return $this->morphMany('Trexology\Taxonomy\Models\TermRelation', 'relationable'); |
| 20 | + } |
18 | 21 |
|
19 | | - public function vocabulary() { |
20 | | - return $this->belongsTo('Trexology\Taxonomy\Models\Vocabulary'); |
21 | | - } |
| 22 | + public function vocabulary() |
| 23 | + { |
| 24 | + return $this->belongsTo('Trexology\Taxonomy\Models\Vocabulary'); |
| 25 | + } |
22 | 26 |
|
23 | | - public function childrens() { |
24 | | - return $this->hasMany('Trexology\Taxonomy\Models\Term', 'parent', 'id') |
25 | | - ->orderBy('weight', 'ASC'); |
26 | | - } |
| 27 | + public function childrens() |
| 28 | + { |
| 29 | + return $this->hasMany('Trexology\Taxonomy\Models\Term', 'parent', 'id') |
| 30 | + ->orderBy('weight', 'ASC'); |
| 31 | + } |
27 | 32 |
|
28 | | - public function parentTerm() { |
29 | | - return $this->hasOne('Trexology\Taxonomy\Models\Term', 'id', 'parent'); |
30 | | - } |
| 33 | + public function parentTerm() |
| 34 | + { |
| 35 | + return $this->hasOne('Trexology\Taxonomy\Models\Term', 'id', 'parent'); |
| 36 | + } |
31 | 37 | } |
0 commit comments