TermContainer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A translations() 0 4 1
A vocabulary() 0 4 1
1
<?php
2
3
/**
4
 * This class represents the container holding all translations of a Term together.
5
 */
6
namespace Rocket\Taxonomy\Model;
7
8
use Illuminate\Database\Eloquent\Model;
9
10
/**
11
 * The main term container
12
 *
13
 * @property int $id
14
 * @property int $vocabulary_id
15
 * @property int $type
16
 */
17
class TermContainer extends Model
18
{
19
    /**
20
     * @var bool Indicates if the model should be timestamped.
21
     */
22
    public $timestamps = false;
23
24
    /**
25
     * @var string The table associated with the model.
26
     */
27
    protected $table = 'taxonomy_terms';
28
29
    /**
30
     * @var array The attributes that are mass assignable.
31
     */
32
    protected $fillable = ['vocabulary_id', 'type'];
33
34
    /**
35
     * All translations available for this term.
36
     *
37
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
38
     */
39 174
    public function translations()
40
    {
41 174
        return $this->hasMany(TermData::class, 'term_id');
42
    }
43
44
    /**
45
     * The vocabulary this term is linked to.
46
     *
47
     * @codeCoverageIgnore
48
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
49
     */
50
    public function vocabulary()
51
    {
52
        return $this->belongsTo(Vocabulary::class, 'vocabulary_id');
53
    }
54
}
55