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 === '') {
20 $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(User::class);
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)
50 return [$this->key, $this->entity_type, $this->entity_id] === [$activityB->key, $activityB->entity_type, $activityB->entity_id];