5 use Illuminate\Database\Eloquent\Model;
10 * @property \Entity entity
11 * @property string extra
13 class Activity extends Model
17 * Get the entity for this activity.
20 public function entity()
22 if ($this->entity_id) {
23 return $this->morphTo('entity')->first();
30 * Get the user this activity relates to.
31 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
33 public function user()
35 return $this->belongsTo('BookStack\User');
39 * Returns text from the language files, Looks up by using the
42 public function getText()
44 return trans('activities.' . $this->key);
48 * Checks if another Activity matches the general information of another.
52 public function isSimilarTo($activityB) {
53 return [$this->key, $this->entitiy_type, $this->entitiy_id] === [$activityB->key, $activityB->entitiy_type, $activityB->entitiy_id];