3 namespace BookStack\Actions;
5 use BookStack\Auth\User;
10 * @property \User user
11 * @property \Entity entity
12 * @property string extra
14 class Activity extends Model
18 * Get the entity for this activity.
20 public function entity()
22 if ($this->entity_type === '') {
23 $this->entity_type = null;
25 return $this->morphTo('entity');
29 * Get the user this activity relates to.
30 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
32 public function user()
34 return $this->belongsTo(User::class);
38 * Returns text from the language files, Looks up by using the
41 public function getText()
43 return trans('activities.' . $this->key);
47 * Checks if another Activity matches the general information of another.
51 public function isSimilarTo($activityB)
53 return [$this->key, $this->entity_type, $this->entity_id] === [$activityB->key, $activityB->entity_type, $activityB->entity_id];