Completed
Push — master ( f93597...e20ab9 )
by ARCANEDEV
06:06
created

Seo::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
use Arcanedev\LaravelSeo\Bases\Model;
4
5
/**
6
 * Class     Seo
7
 *
8
 * @package  Arcanedev\LaravelSeo\Models
9
 * @author   ARCANEDEV <[email protected]>
10
 *
11
 * @property  int                                  id
12
 * @property  int                                  seoable_id
13
 * @property  string                               seoable_type
14
 * @property  string                               title
15
 * @property  string                               description
16
 * @property  string                               keywords
17
 * @property  \Illuminate\Support\Collection       metas
18
 * @property  boolean                              noindex
19
 * @property  \Carbon\Carbon                       created_at
20
 * @property  \Carbon\Carbon                       updated_at
21
 *
22
 * @property  \Illuminate\Database\Eloquent\Model  seoable
23
 */
24
class Seo extends Model
25
{
26
    /* ------------------------------------------------------------------------------------------------
27
     |  Properties
28
     | ------------------------------------------------------------------------------------------------
29
     */
30
    /**
31
     * The table associated with the model.
32
     *
33
     * @var string
34
     */
35
    protected $table = 'seo';
36
37
    /**
38
     * The attributes that are mass assignable.
39
     *
40
     * @var array
41
     */
42
    protected $fillable = ['title', 'keywords', 'description', 'metas', 'noindex'];
43
44
    /**
45
     * The attributes that should be casted to native types.
46
     *
47
     * @var array
48
     */
49
    protected $casts = [
50
        'id'         => 'integer',
51
        'seoable_id' => 'integer',
52
        'metas'      => 'collection',
53
        'noindex'    => 'boolean',
54
    ];
55
56
    /* ------------------------------------------------------------------------------------------------
57
     |  Constructor
58
     | ------------------------------------------------------------------------------------------------
59
     */
60
    /**
61
     * Create a new Eloquent model instance.
62
     *
63
     * @param  array  $attributes
64
     */
65 36
    public function __construct(array $attributes = [])
66
    {
67 36
        $this->setTable(config('laravel-seo.database.table', 'seo'));
68
69 36
        parent::__construct($attributes);
70 36
    }
71
72
    /* ------------------------------------------------------------------------------------------------
73
     |  Relationships
74
     | ------------------------------------------------------------------------------------------------
75
     */
76
    /**
77
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
78
     */
79 9
    public function seoable()
80
    {
81 9
        return $this->morphTo();
82
    }
83
}
84