Completed
Push — master ( acece9...67426a )
by ARCANEDEV
13s
created

Meta::seoable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\LaravelSeo\Models;
2
3
/**
4
 * Class     Meta
5
 *
6
 * @package  Arcanedev\LaravelSeo\Models
7
 * @author   ARCANEDEV <[email protected]>
8
 *
9
 * @property  int                                  id
10
 * @property  int                                  seoable_id
11
 * @property  string                               seoable_type
12
 * @property  string                               title
13
 * @property  string                               description
14
 * @property  string                               keywords
15
 * @property  \Illuminate\Support\Collection       metas
16
 * @property  boolean                              noindex
17
 * @property  \Carbon\Carbon                       created_at
18
 * @property  \Carbon\Carbon                       updated_at
19
 *
20
 * @property  \Illuminate\Database\Eloquent\Model  seoable
21
 */
22
class Meta extends AbstractModel
23
{
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Properties
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * The attributes that are mass assignable.
30
     *
31
     * @var array
32
     */
33
    protected $fillable = ['title', 'description', 'keywords', 'metas', 'noindex'];
34
35
    /**
36
     * The attributes that should be casted to native types.
37
     *
38
     * @var array
39
     */
40
    protected $casts = [
41
        'id'         => 'integer',
42
        'seoable_id' => 'integer',
43
        'metas'      => 'collection',
44
        'noindex'    => 'boolean',
45
    ];
46
47
    /* ------------------------------------------------------------------------------------------------
48
     |  Constructor
49
     | ------------------------------------------------------------------------------------------------
50
     */
51
    /**
52
     * Create a new Eloquent model instance.
53
     *
54
     * @param  array  $attributes
55
     */
56 12
    public function __construct(array $attributes = [])
57
    {
58 12
        parent::__construct($attributes);
59
60 12
        $this->setTable(config('laravel-seo.database.table', 'metas'));
61 12
    }
62
63
    /* ------------------------------------------------------------------------------------------------
64
     |  Relationships
65
     | ------------------------------------------------------------------------------------------------
66
     */
67
    /**
68
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
69
     */
70 3
    public function seoable()
71
    {
72 3
        return $this->morphTo();
73
    }
74
}
75