public function render() {
        $notifications = $this->session->get('toastr::notifications');
        if(!$notifications) $notifications = array();

        $output = '<script type="text/javascript">';
        $lastConfig = [];
        foreach($notifications as $notification) {

            $config = $this->config->get('toastr::options');
           
            if(count($notification['options']) > 0) {
                // Merge user supplied options with default options
                $config = array_merge($config, $notification['options']);
            }

            // Config persists between toasts
            if($config != $lastConfig) {
                $output .= 'toastr.options = ' . json_encode($config) . ';';   
                $lastConfig = $config;
            }

            // Toastr output
            $output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", htmlentities($notification['message'])) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
        }
        $output .= '</script>';

        return $output;
    }
public function render() {
        $notifications = $this->session->get('toastr::notifications');
        if(!$notifications) $notifications = array();

        $output = '<script type="text/javascript">';
        $lastConfig = [];
        foreach($notifications as $notification) {

            $config = $this->config->get('toastr::options');
           
            if(count($notification['options']) > 0) {
                // Merge user supplied options with default options
                $config = array_merge($config, $notification['options']);
            }

            // Config persists between toasts
            if($config != $lastConfig) {
                $output .= 'toastr.options = ' . json_encode($config) . ';';   
                $lastConfig = $config;
            }

            // Toastr output
            $output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", htmlentities($notification['message'])) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
        }
        $output .= '</script>';

        return $output;
    }
public function render ( ) { $ notifications = $ this -> session -> get ( 'toastr::notifications' ) ; if ( ! $ notifications ) $ notifications = array ( ) ; $ output = '<script type="text/javascript">' ; $ lastConfig = [ ] ; foreach ( $ notifications as $ notification ) { $ config = $ this -> config -> get ( 'toastr::options' ) ; if ( count ( $ notification [ 'options' ] ) > 0 ) { // Merge user supplied options with default options $ config = array_merge ( $ config , $ notification [ 'options' ] ) ; } // Config persists between toasts if ( $ config != $ lastConfig ) { $ output .= 'toastr.options = ' . json_encode ( $ config ) . ';' ; $ lastConfig = $ config ; } // Toastr output $ output .= 'toastr.' . $ notification [ 'type' ] . "('" . str_replace ( "'" , "\\'" , htmlentities ( $ notification [ 'message' ] ) ) . "'" . ( isset ( $ notification [ 'title' ] ) ? ", '" . str_replace ( "'" , "\\'" , htmlentities ( $ notification [ 'title' ] ) ) . "'" : null ) . ');' ; } $ output .= '</script>' ; return $ output ; }
Render the notifications' script tag

@param bool $flashed Whether to get the

@return string
Render the notifications script tag