| @@ 6-27 (lines=22) @@ | ||
| 3 | ||
| 4 | use GrahamCampbell\Markdown\Facades\Markdown; |
|
| 5 | ||
| 6 | trait CommentPresenter |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Get the content parsed in HTML. |
|
| 10 | * |
|
| 11 | * @return string |
|
| 12 | */ |
|
| 13 | public function getContentMarkdownAttribute(): string |
|
| 14 | { |
|
| 15 | return Markdown::convertToHtml($this->content); |
|
| 16 | } |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Get the comment url. |
|
| 20 | * |
|
| 21 | * @return string |
|
| 22 | */ |
|
| 23 | public function getCommentUrlAttribute(): string |
|
| 24 | { |
|
| 25 | return route('blog.comment.show', ['id' => $this->getKey()]); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||
| @@ 6-27 (lines=22) @@ | ||
| 3 | ||
| 4 | use GrahamCampbell\Markdown\Facades\Markdown; |
|
| 5 | ||
| 6 | trait DiscussPostPresenter |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Get the content parsed in HTML. |
|
| 10 | * |
|
| 11 | * @return string |
|
| 12 | */ |
|
| 13 | public function getContentMarkdownAttribute(): string |
|
| 14 | { |
|
| 15 | return Markdown::convertToHtml($this->content); |
|
| 16 | } |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Get the post url. |
|
| 20 | * |
|
| 21 | * @return string |
|
| 22 | */ |
|
| 23 | public function getPostUrlAttribute(): string |
|
| 24 | { |
|
| 25 | return route('discuss.post.show', ['id' => $this->getKey()]); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||