8 * @property \Entity entity
9 * @property string extra
11 class Activity extends Model
15 * Get the entity for this activity.
17 public function entity()
19 if ($this->entity_type === '') $this->entity_type = null;
20 return $this->morphTo('entity');
24 * Get the user this activity relates to.
25 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
27 public function user()
29 return $this->belongsTo(User::class);
33 * Returns text from the language files, Looks up by using the
36 public function getText()
38 return trans('activities.' . $this->key);
42 * Checks if another Activity matches the general information of another.
46 public function isSimilarTo($activityB) {
47 return [$this->key, $this->entity_type, $this->entity_id] === [$activityB->key, $activityB->entity_type, $activityB->entity_id];