]> BookStack Code Mirror - bookstack/blob - app/PageRevision.php
Added basic system tests for markdown editor, Added extra test helpers
[bookstack] / app / PageRevision.php
1 <?php namespace BookStack;
2
3 use Illuminate\Database\Eloquent\Model;
4
5 class PageRevision extends Model
6 {
7     protected $fillable = ['name', 'html', 'text', 'markdown'];
8
9     /**
10      * Get the user that created the page revision
11      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
12      */
13     public function createdBy()
14     {
15         return $this->belongsTo('BookStack\User', 'created_by');
16     }
17
18     /**
19      * Get the page this revision originates from.
20      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
21      */
22     public function page()
23     {
24         return $this->belongsTo('BookStack\Page');
25     }
26
27     /**
28      * Get the url for this revision.
29      * @return string
30      */
31     public function getUrl()
32     {
33         return $this->page->getUrl() . '/revisions/' . $this->id;
34     }
35
36 }