1 <?php namespace BookStack;
3 class Comment extends Ownable
5 protected $fillable = ['text', 'html', 'parent_id'];
6 protected $appends = ['created', 'updated'];
9 * Get the entity that this comment belongs to
10 * @return \Illuminate\Database\Eloquent\Relations\MorphTo
12 public function entity()
14 return $this->morphTo('entity');
18 * Check if a comment has been updated since creation.
21 public function isUpdated()
23 return $this->updated_at->timestamp > $this->created_at->timestamp;
27 * Get created date as a relative diff.
30 public function getCreatedAttribute()
32 return $this->created_at->diffForHumans();
36 * Get updated date as a relative diff.
39 public function getUpdatedAttribute()
41 return $this->updated_at->diffForHumans();