Completed
Push — master ( 24a4a5...63e31a )
by
unknown
07:23
created

Translation::locale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BBSLab\NovaTranslation\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
8
/**
9
 * @property int $locale_id
10
 * @property int $translation_id
11
 * @property int $translatable_id
12
 * @property string $translatable_type
13
 * @property \BBSLab\NovaTranslation\Models\Locale $locale
14
 */
15
class Translation extends Model
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    protected $table = 'translations';
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected $primaryKey = null;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public $incrementing = false;
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public $timestamps = false;
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    protected $fillable = [
41
        'locale_id',
42
        'translation_id',
43
        'translatable_id',
44
        'translatable_type',
45
    ];
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    protected $casts = [
51
        'locale_id' => 'integer',
52
        'translation_id' => 'integer',
53
        'translatable_id' => 'integer',
54
    ];
55
56
    /**
57
     * Translatable polymorphic relationship.
58
     *
59
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
60
     */
61
    public function translatable(): MorphTo
62
    {
63
        return $this->morphTo();
64
    }
65
66
    /**
67
     * Locale relationship.
68
     *
69
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
70
     */
71
    public function locale()
72
    {
73
        return $this->belongsTo(Locale::class);
74
    }
75
}
76