*/ protected $casts = [ 'id' => 'string', 'actor_id' => 'integer', 'target_actor_id' => '?integer', 'note_id' => '?string', 'type' => 'string', 'payload' => 'json', 'status' => '?string', ]; public function getActor(): Actor { if ($this->actor_id === null) { throw new RuntimeException('Activity must have an actor_id before getting the actor.',); } if ($this->actor === null) { $this->actor = model('ActorModel') ->getActorById($this->actor_id); } return $this->actor; } public function getTargetActor(): Actor { if ($this->target_actor_id === null) { throw new RuntimeException('Activity must have a target_actor_id before getting the target actor.',); } if ($this->target_actor === null) { $this->target_actor = model('ActorModel') ->getActorById($this->target_actor_id,); } return $this->target_actor; } public function getNote(): Note { if ($this->note_id === null) { throw new RuntimeException('Activity must have a note_id before getting note.',); } if ($this->note === null) { $this->note = model('NoteModel') ->getNoteById($this->note_id); } return $this->note; } }