public function render(array $variables = []): string
    {
        // Set the variables with the new variables and this view instance
        $this->variables = array_merge(
            $this->variables,
            $variables,
            ['view' => $this]
        );

        // Render the template
        $template = $this->renderTemplate($this->templatePath);

        // Check if a layout has been set
        if (null === $this->layout) {
            return $template;
        }

        // Begin tracking layout changes for recursive layout
        $this->trackLayoutChanges = true;

        return $this->renderTemplate($this->layoutPath);
    }