1 <?php namespace BookStack\Actions;
6 * @property string text
7 * @property string html
8 * @property int|null parent_id
9 * @property int local_id
11 class Comment extends Ownable
13 protected $fillable = ['text', 'parent_id'];
14 protected $appends = ['created', 'updated'];
17 * Get the entity that this comment belongs to
18 * @return \Illuminate\Database\Eloquent\Relations\MorphTo
20 public function entity()
22 return $this->morphTo('entity');
26 * Check if a comment has been updated since creation.
29 public function isUpdated()
31 return $this->updated_at->timestamp > $this->created_at->timestamp;
35 * Get created date as a relative diff.
38 public function getCreatedAttribute()
40 return $this->created_at->diffForHumans();
44 * Get updated date as a relative diff.
47 public function getUpdatedAttribute()
49 return $this->updated_at->diffForHumans();