currentVisitor = $user; } public function __get( string $name ): mixed { return $this->currentVisitor?->$name; } public function __invoke( int $userId ): ?XenForoUser { if( !isset( $this->users[$userId] ) ){ $this->users[$userId] = app(XenforoService::class)->getXfUser($userId); } return $this->users[$userId]; } public function loggedIn(): bool { return $this->currentVisitor !== null; } public function guest(): bool { return $this->currentVisitor === null; } }