| @@ 4-19 (lines=16) @@ | ||
| 1 | <?php |
|
| 2 | namespace Xetaravel\Models\Presenters; |
|
| 3 | ||
| 4 | trait ArticlePresenter |
|
| 5 | { |
|
| 6 | /** |
|
| 7 | * Get the article url. |
|
| 8 | * |
|
| 9 | * @return string |
|
| 10 | */ |
|
| 11 | public function getArticleUrlAttribute(): string |
|
| 12 | { |
|
| 13 | if (!isset($this->slug)) { |
|
| 14 | return ''; |
|
| 15 | } |
|
| 16 | ||
| 17 | return route('blog.article.show', ['slug' => $this->slug, 'id' => $this->getKey()]); |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||
| @@ 4-19 (lines=16) @@ | ||
| 1 | <?php |
|
| 2 | namespace Xetaravel\Models\Presenters; |
|
| 3 | ||
| 4 | trait CategoryPresenter |
|
| 5 | { |
|
| 6 | /** |
|
| 7 | * Get the category url. |
|
| 8 | * |
|
| 9 | * @return string |
|
| 10 | */ |
|
| 11 | public function getCategoryUrlAttribute(): string |
|
| 12 | { |
|
| 13 | if (!isset($this->slug)) { |
|
| 14 | return ''; |
|
| 15 | } |
|
| 16 | ||
| 17 | return route('blog.category.show', ['slug' => $this->slug, 'id' => $this->getKey()]); |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||
| @@ 4-19 (lines=16) @@ | ||
| 1 | <?php |
|
| 2 | namespace Xetaravel\Models\Presenters; |
|
| 3 | ||
| 4 | trait DiscussCategoryPresenter |
|
| 5 | { |
|
| 6 | /** |
|
| 7 | * Get the category url. |
|
| 8 | * |
|
| 9 | * @return string |
|
| 10 | */ |
|
| 11 | public function getCategoryUrlAttribute(): string |
|
| 12 | { |
|
| 13 | if (!isset($this->slug)) { |
|
| 14 | return ''; |
|
| 15 | } |
|
| 16 | ||
| 17 | return route('discuss.category.show', ['slug' => $this->slug, 'id' => $this->getKey()]); |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||
| @@ 4-19 (lines=16) @@ | ||
| 1 | <?php |
|
| 2 | namespace Xetaravel\Models\Presenters; |
|
| 3 | ||
| 4 | trait DiscussThreadPresenter |
|
| 5 | { |
|
| 6 | /** |
|
| 7 | * Get the thread url. |
|
| 8 | * |
|
| 9 | * @return string |
|
| 10 | */ |
|
| 11 | public function getThreadUrlAttribute(): string |
|
| 12 | { |
|
| 13 | if (!isset($this->slug)) { |
|
| 14 | return ''; |
|
| 15 | } |
|
| 16 | ||
| 17 | return route('discuss.thread.show', ['slug' => $this->slug, 'id' => $this->getKey()]); |
|
| 18 | } |
|
| 19 | } |
|
| 20 | ||