1 <?php namespace BookStack;
3 class Attachment extends Ownable
5 protected $fillable = ['name', 'order'];
8 * Get the downloadable file name for this upload.
11 public function getFileName()
13 if (str_contains($this->name, '.')) {
16 return $this->name . '.' . $this->extension;
20 * Get the page this file was uploaded to.
23 public function page()
25 return $this->belongsTo(Page::class, 'uploaded_to');
29 * Get the url of this file.
32 public function getUrl()
34 return baseUrl('/attachments/' . $this->id);