| 1 | <?php namespace Arcanedev\LaravelSeo\Traits; |
||
| 15 | trait Seoable |
||
| 16 | { |
||
| 17 | /* ----------------------------------------------------------------- |
||
| 18 | | Relationships |
||
| 19 | | ----------------------------------------------------------------- |
||
| 20 | */ |
||
| 21 | |||
| 22 | /** |
||
| 23 | * SEO relationship. |
||
| 24 | * |
||
| 25 | * @return \Illuminate\Database\Eloquent\Relations\MorphOne |
||
| 26 | */ |
||
| 27 | 20 | public function seo() |
|
| 31 | |||
| 32 | /* ----------------------------------------------------------------- |
||
| 33 | | Main Methods |
||
| 34 | | ----------------------------------------------------------------- |
||
| 35 | */ |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Create a SEO Meta. |
||
| 39 | * |
||
| 40 | * @param array $attributes |
||
| 41 | * |
||
| 42 | * @return \Arcanedev\LaravelSeo\Models\Meta|mixed |
||
| 43 | */ |
||
| 44 | 20 | public function createSeo(array $attributes) |
|
| 45 | { |
||
| 46 | 20 | return $this->seo()->create( |
|
| 47 | 20 | Meta::prepareAttributes($attributes) |
|
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Update a SEO Meta. |
||
| 53 | * |
||
| 54 | * @param array $attributes |
||
| 55 | * |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | 4 | public function updateSeo(array $attributes) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * Delete a seo. |
||
| 65 | * |
||
| 66 | * @return bool|null |
||
| 67 | */ |
||
| 68 | 4 | public function deleteSeo() |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Check if it has seo. |
||
| 75 | * |
||
| 76 | * @return bool |
||
| 77 | */ |
||
| 78 | 20 | public function hasSeo() |
|
| 82 | } |
||
| 83 |