]> BookStack Code Mirror - bookstack/blob - app/File.php
Added view, deletion and permissions for files
[bookstack] / app / File.php
1 <?php namespace BookStack;
2
3
4 class File extends Ownable
5 {
6     protected $fillable = ['name', 'order'];
7
8     /**
9      * Get the page this file was uploaded to.
10      * @return Page
11      */
12     public function page()
13     {
14         return $this->belongsTo(Page::class, 'uploaded_to');
15     }
16
17     /**
18      * Get the url of this file.
19      * @return string
20      */
21     public function getUrl()
22     {
23         return '/files/' . $this->id;
24     }
25
26 }