    private function formatResponse($view, $title, $settings, $status = 'ok')
    {
        if ($view instanceof View) {
            $html = $view->__toString();
            $show_settings = (int) Str::startsWith($view->getName(), 'widgets.settings.');
        } else {
            $html = (string) $view;
            $show_settings = (int) $this->show_settings;
        }

        return response()->json([
            'status' => $status,
            'title' => __($title),
            'html' => $html,
            'show_settings' => $show_settings,
            'settings' => $settings,
        ]);
    }