]> BookStack Code Mirror - bookstack/blob - app/Comment.php
Added comments controller, model, repo, and the database schema. Modified existing...
[bookstack] / app / Comment.php
1 <?php
2
3 namespace BookStack;
4
5 class Comment extends Ownable
6 {
7     protected $fillable = ['text', 'html'];
8     
9     /**
10      * Get the entity that this comment belongs to
11      * @return \Illuminate\Database\Eloquent\Relations\MorphTo
12      */
13     public function entity()
14     {
15         return $this->morphTo('entity');
16     }
17     
18     /**
19      * Get the page that this comment is in.
20      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
21      */
22     public function page()
23     {
24         return $this->belongsTo(Page::class);
25     }
26     
27     /**
28      * Get the owner of this comment.
29      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
30      */
31     public function user() 
32     {
33         return $this->belongsTo(User::class);
34     }
35 }