2016-10-09 19:58:22 +02:00
|
|
|
<?php namespace BookStack;
|
|
|
|
|
|
|
|
|
|
|
|
class File extends Ownable
|
|
|
|
{
|
|
|
|
protected $fillable = ['name', 'order'];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the page this file was uploaded to.
|
2016-10-10 21:30:27 +02:00
|
|
|
* @return Page
|
2016-10-09 19:58:22 +02:00
|
|
|
*/
|
|
|
|
public function page()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Page::class, 'uploaded_to');
|
|
|
|
}
|
|
|
|
|
2016-10-10 21:30:27 +02:00
|
|
|
/**
|
|
|
|
* Get the url of this file.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getUrl()
|
|
|
|
{
|
|
|
|
return '/files/' . $this->id;
|
|
|
|
}
|
2016-10-09 19:58:22 +02:00
|
|
|
|
|
|
|
}
|