*/ protected $casts = [ 'id' => 'integer', 'title' => 'string', 'slug' => 'string', 'content_markdown' => 'string', 'content_html' => 'string', ]; public function getLink(): string { return url_to('page', $this->attributes['slug']); } public function setContentMarkdown(string $contentMarkdown): static { $converter = new CommonMarkConverter([ 'html_input' => 'strip', 'allow_unsafe_links' => false, ]); $this->attributes['content_markdown'] = $contentMarkdown; $this->attributes['content_html'] = $converter->convertToHtml($contentMarkdown,); return $this; } }