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