1 | <?php |
||
8 | class SeoData extends Model implements SeoDataContract |
||
9 | { |
||
10 | /** @var array */ |
||
11 | protected $fillable = [ |
||
12 | 'meta', |
||
13 | 'open_graph', |
||
14 | 'twitter', |
||
15 | ]; |
||
16 | |||
17 | /** @var array */ |
||
18 | protected $casts = [ |
||
19 | 'meta' => 'array', |
||
20 | 'open_graph' => 'array', |
||
21 | 'twitter' => 'array', |
||
22 | ]; |
||
23 | |||
24 | 9 | public function __construct(array $attributes = []) |
|
30 | |||
31 | public function seoable() |
||
35 | |||
36 | public function getSeoData(): array |
||
37 | { |
||
38 | $meta = $this->meta; |
||
39 | $open_graph = $this->open_graph; |
||
40 | $twitter_card = $this->twitter_card; |
||
41 | |||
42 | $meta += ['open_graph' => ! empty($open_graph) ? $open_graph : []]; |
||
43 | |||
44 | $meta += ['twitter_card' => ! empty($twitter_card) ? $twitter_card : []]; |
||
45 | |||
46 | return $meta; |
||
47 | } |
||
48 | |||
49 | public function getSeoableModel(): string |
||
53 | } |
||
54 |