TermContent::relationable()   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 the link from a Term to any Model
5
 */
6
namespace Rocket\Taxonomy\Model;
7
8
use Illuminate\Database\Eloquent\Model;
9
10
/**
11
 * Relations from a term to a content
12
 *
13
 * @property int $term_id
14
 * @property int $relationable_id
15
 * @property string $relationable_type
16
 */
17
class TermContent 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_content';
28
29
    /**
30
     * @var array The attributes that are mass assignable.
31
     */
32
    protected $fillable = ['term_id'];
33
34
    /**
35
     * The term linked to this relation.
36
     *
37
     * @codeCoverageIgnore
38
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
39
     */
40
    public function term()
41
    {
42
        return $this->belongsTo(TermContainer::class, 'term_id');
43
    }
44
45
    /**
46
     * The model linked to this relation.
47
     *
48
     * @codeCoverageIgnore
49
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
50
     */
51
    public function relationable()
52
    {
53
        return $this->morphTo();
54
    }
55
}
56