1 <?php namespace BookStack\Actions;
5 class Comment extends Ownable
7 protected $fillable = ['text', 'html', 'parent_id'];
8 protected $appends = ['created', 'updated'];
11 * Get the entity that this comment belongs to
12 * @return \Illuminate\Database\Eloquent\Relations\MorphTo
14 public function entity()
16 return $this->morphTo('entity');
20 * Check if a comment has been updated since creation.
23 public function isUpdated()
25 return $this->updated_at->timestamp > $this->created_at->timestamp;
29 * Get created date as a relative diff.
32 public function getCreatedAttribute()
34 return $this->created_at->diffForHumans();
38 * Get updated date as a relative diff.
41 public function getUpdatedAttribute()
43 return $this->updated_at->diffForHumans();