*/ protected $casts = [ 'id' => 'string', 'uri' => 'string', 'actor_id' => 'integer', 'in_reply_to_id' => '?string', 'reblog_of_id' => '?string', 'episode_id' => '?integer', 'message' => 'string', 'message_html' => 'string', 'favourites_count' => 'integer', 'reblogs_count' => 'integer', 'replies_count' => 'integer', 'created_by' => 'integer', ]; /** * Returns the note's attached episode */ public function getEpisode(): ?Episode { if ($this->episode_id === null) { throw new RuntimeException( 'Note must have an episode_id before getting episode.', ); } if ($this->episode === null) { $this->episode = (new EpisodeModel())->getEpisodeById( $this->episode_id, ); } return $this->episode; } }