public function render($namespace = 'config')
    {
        foreach ($this->variables as $key => $variable) {
            if ($variable instanceof Closure) {
                $variable = $variable();

                if (is_array($variable)) {
                    $this->add($variable);
                }
            }
        }

        $variables = array_filter($this->variables, function ($variable) {
            return !$variable instanceof Closure;
        });

        return new HtmlString(
            '<script>window.'.$namespace.' = '.json_encode($variables).';</script>'
        );
    }
public function render($namespace = 'config')
    {
        foreach ($this->variables as $key => $variable) {
            if ($variable instanceof Closure) {
                $variable = $variable();

                if (is_array($variable)) {
                    $this->add($variable);
                }
            }
        }

        $variables = array_filter($this->variables, function ($variable) {
            return !$variable instanceof Closure;
        });

        return new HtmlString(
            '<script>window.'.$namespace.' = '.json_encode($variables).';</script>'
        );
    }
public function render ( $ namespace = 'config' ) { foreach ( $ this -> variables as $ key => $ variable ) { if ( $ variable instanceof Closure ) { $ variable = $ variable ( ) ; if ( is_array ( $ variable ) ) { $ this -> add ( $ variable ) ; } } } $ variables = array_filter ( $ this -> variables , function ( $ variable ) { return ! $ variable instanceof Closure ; } ) ; return new HtmlString ( '<script>window.' . $ namespace . ' = ' . json_encode ( $ variables ) . ';</script>' ) ; }
Render as a HTML string.

@param string $namespace

@return \Illuminate\Support\HtmlString
Render as a HTML string .