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.
19 public function entity()
21 if ($this->entity_type === '') $this->entity_type = null;
22 return $this->morphTo('entity');
26 * Get the user this activity relates to.
27 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
29 public function user()
31 return $this->belongsTo('BookStack\User');
35 * Returns text from the language files, Looks up by using the
38 public function getText()
40 return trans('activities.' . $this->key);
44 * Checks if another Activity matches the general information of another.
48 public function isSimilarTo($activityB) {
49 return [$this->key, $this->entitiy_type, $this->entitiy_id] === [$activityB->key, $activityB->entitiy_type, $activityB->entitiy_id];