X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ddb7f33868ea499ab8f48a7062f145e8c0fbe02f..refs/pull/2522/head:/app/Uploads/Attachment.php diff --git a/app/Uploads/Attachment.php b/app/Uploads/Attachment.php index 3f0b447df..d1060477d 100644 --- a/app/Uploads/Attachment.php +++ b/app/Uploads/Attachment.php @@ -1,10 +1,20 @@ external && strpos($this->path, 'http') !== 0) { return $this->path; } return url('/http/source.bookstackapp.com/attachments/' . $this->id); } + + /** + * Generate a HTML link to this attachment. + */ + public function htmlLink(): string + { + return ''.e($this->name).''; + } + + /** + * Generate a markdown link to this attachment. + */ + public function markdownLink(): string + { + return '['. $this->name .']('. $this->getUrl() .')'; + } }