*/ protected $casts = [ 'id' => 'integer', 'uri' => 'string', 'username' => 'string', 'domain' => 'string', 'display_name' => 'string', 'summary' => '?string', 'private_key' => '?string', 'public_key' => '?string', 'avatar_image_url' => '?string', 'avatar_image_mimetype' => '?string', 'cover_image_url' => '?string', 'cover_image_mimetype' => '?string', 'inbox_url' => 'string', 'outbox_url' => '?string', 'followers_url' => '?string', 'followers_count' => 'integer', 'posts_count' => 'integer', 'is_blocked' => 'boolean', ]; public function getPublicKeyId(): string { return $this->uri . '#main-key'; } public function getIsLocal(): bool { if (! $this->is_local) { $uri = current_url(true); $this->is_local = $this->domain === $uri->getHost() . ($uri->getPort() ? ':' . $uri->getPort() : ''); } return $this->is_local; } /** * @return Actor[] */ public function getFollowers(): array { if ($this->id === null) { throw new RuntimeException('Actor must be created before getting followers.'); } if ($this->followers === null) { $this->followers = (array) model('ActorModel', false) ->getFollowers($this->id); } return $this->followers; } public function getAvatarImageUrl(): string { if ($this->attributes['avatar_image_url'] === null) { return base_url(config(Fediverse::class)->defaultAvatarImagePath); } return $this->attributes['avatar_image_url']; } public function getAvatarImageMimetype(): string { if ($this->attributes['avatar_image_mimetype'] === null) { return config(Fediverse::class)->defaultAvatarImageMimetype; } return $this->attributes['avatar_image_mimetype']; } public function getCoverImageUrl(): string { if ($this->attributes['cover_image_url'] === null) { return base_url(config(Fediverse::class)->defaultCoverImagePath); } return $this->attributes['cover_image_url']; } public function getCoverImageMimetype(): string { if ($this->attributes['cover_image_mimetype'] === null) { return config(Fediverse::class)->defaultCoverImageMimetype; } return $this->attributes['cover_image_mimetype']; } }