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
|
|
|
|