]> BookStack Code Mirror - bookstack/blob - app/Attachment.php
Removes some unused code.
[bookstack] / app / Attachment.php
1 <?php namespace BookStack;
2
3
4 class Attachment extends Ownable
5 {
6     protected $fillable = ['name', 'order'];
7
8     /**
9      * Get the downloadable file name for this upload.
10      * @return mixed|string
11      */
12     public function getFileName()
13     {
14         if (str_contains($this->name, '.')) return $this->name;
15         return $this->name . '.' . $this->extension;
16     }
17
18     /**
19      * Get the page this file was uploaded to.
20      * @return Page
21      */
22     public function page()
23     {
24         return $this->belongsTo(Page::class, 'uploaded_to');
25     }
26
27     /**
28      * Get the url of this file.
29      * @return string
30      */
31     public function getUrl()
32     {
33         return baseUrl('/attachments/' . $this->id);
34     }
35
36 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.