1 <?php namespace BookStack;
4 class Attachment extends Ownable
6 protected $fillable = ['name', 'order'];
9 * Get the downloadable file name for this upload.
10 * @return mixed|string
12 public function getFileName()
14 if (str_contains($this->name, '.')) return $this->name;
15 return $this->name . '.' . $this->extension;
19 * Get the page this file was uploaded to.
22 public function page()
24 return $this->belongsTo(Page::class, 'uploaded_to');
28 * Get the url of this file.
31 public function getUrl()
33 return baseUrl('/attachments/' . $this->id);