Loading app/Entities/EpisodeComment.php +0 −2 Original line number Diff line number Diff line Loading @@ -97,12 +97,10 @@ class EpisodeComment extends UuidEntity } if (! $this->actor instanceof Actor) { // @phpstan-ignore-next-line $this->actor = model(ActorModel::class, false) ->getActorById($this->actor_id); } // @phpstan-ignore-next-line return $this->actor; } Loading app/Entities/Podcast.php +0 −2 Original line number Diff line number Diff line Loading @@ -207,12 +207,10 @@ class Podcast extends Entity } if (! $this->actor instanceof Actor) { // @phpstan-ignore-next-line $this->actor = model(ActorModel::class, false) ->getActorById($this->actor_id); } // @phpstan-ignore-next-line return $this->actor; } Loading app/Models/ActorModel.php +14 −0 Original line number Diff line number Diff line Loading @@ -19,4 +19,18 @@ class ActorModel extends FediverseActorModel * @var string */ protected $returnType = Actor::class; public function getActorById(int $id): ?Actor { $cacheName = config('Fediverse') ->cachePrefix . "actor#{$id}"; if (! ($found = cache($cacheName))) { $found = $this->find($id); cache() ->save($cacheName, $found, DECADE); } return $found; } } Loading
app/Entities/EpisodeComment.php +0 −2 Original line number Diff line number Diff line Loading @@ -97,12 +97,10 @@ class EpisodeComment extends UuidEntity } if (! $this->actor instanceof Actor) { // @phpstan-ignore-next-line $this->actor = model(ActorModel::class, false) ->getActorById($this->actor_id); } // @phpstan-ignore-next-line return $this->actor; } Loading
app/Entities/Podcast.php +0 −2 Original line number Diff line number Diff line Loading @@ -207,12 +207,10 @@ class Podcast extends Entity } if (! $this->actor instanceof Actor) { // @phpstan-ignore-next-line $this->actor = model(ActorModel::class, false) ->getActorById($this->actor_id); } // @phpstan-ignore-next-line return $this->actor; } Loading
app/Models/ActorModel.php +14 −0 Original line number Diff line number Diff line Loading @@ -19,4 +19,18 @@ class ActorModel extends FediverseActorModel * @var string */ protected $returnType = Actor::class; public function getActorById(int $id): ?Actor { $cacheName = config('Fediverse') ->cachePrefix . "actor#{$id}"; if (! ($found = cache($cacheName))) { $found = $this->find($id); cache() ->save($cacheName, $found, DECADE); } return $found; } }