-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ARCANEDEV/patch-2
Adding Meta accessors
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php namespace Arcanedev\LaravelSeo\Models\Presenters; | ||
|
||
/** | ||
* Class MetaPresenter | ||
* | ||
* @package Arcanedev\LaravelSeo\Models\Presenters | ||
* @author ARCANEDEV <arcanedev.maroc@gmail.com> | ||
* | ||
* @property string title | ||
* @property int title_length | ||
* @property string description | ||
* @property int description_length | ||
* @property \Illuminate\Support\Collection keywords | ||
* @property string keywords_string | ||
* @property int keywords_length | ||
*/ | ||
trait MetaPresenter | ||
{ | ||
/* ----------------------------------------------------------------- | ||
| Accessors | ||
| ----------------------------------------------------------------- | ||
*/ | ||
/** | ||
* Get the `title_length` attribute. | ||
* | ||
* @return int | ||
*/ | ||
public function getTitleLengthAttribute() | ||
{ | ||
return strlen($this->title); | ||
} | ||
|
||
/** | ||
* Get the `description_length` attribute. | ||
* | ||
* @return int | ||
*/ | ||
public function getDescriptionLengthAttribute() | ||
{ | ||
return strlen($this->description); | ||
} | ||
|
||
/** | ||
* Get the `keywords_string` attribute. | ||
* | ||
* @return string | ||
*/ | ||
public function getKeywordsStringAttribute() | ||
{ | ||
return $this->keywords->implode(', '); | ||
} | ||
|
||
/** | ||
* Get the `keywords_length` attribute. | ||
* | ||
* @return int | ||
*/ | ||
public function getKeywordsLengthAttribute() | ||
{ | ||
return strlen($this->keywords_string); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters