Hierarchy::parent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Represents thelinks between parents and children terms.
5
 */
6
namespace Rocket\Taxonomy\Model;
7
8
use Illuminate\Database\Eloquent\Model;
9
10
/**
11
 * Parent-child relations between terms
12
 *
13
 * @property int $term_id
14
 * @property int $parent_id
15
 */
16
class Hierarchy extends Model
17
{
18
    /**
19
     * @var bool Indicates if the model should be timestamped.
20
     */
21
    public $timestamps = false;
22
23
    /**
24
     * @var string The table associated with the model.
25
     */
26
    protected $table = 'taxonomy_term_hierarchy';
27
28
    /**
29
     * Get the term related to this entry
30
     *
31
     * @codeCoverageIgnore
32
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
33
     */
34
    public function term()
35
    {
36
        return $this->belongsTo(TermContainer::class, 'term_id');
37
    }
38
39
    /**
40
     * Get the parent term of this entry
41
     *
42
     * @codeCoverageIgnore
43
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
44
     */
45
    public function parent()
46
    {
47
        return $this->belongsTo(TermContainer::class, 'parent_id');
48
    }
49
}
50