Originally, this filter called $response->getOriginalContent(). Calling getOriginalContent returns an Illuminate\View\View instance; which already has rendered content available
in $response->getContent(). By applying the preg_replace to getOriginalContent(), you invoke the __toString() method of the View instance, which will cause the template to
be rendered twice... this means that all PHP code will be executed twice (including any calls to $user->relation in your view) which makes this a costly operation.

So instead we should apply the preg_replace to the rendered content of $response->getContent(), to avoid duplicate View rendering.