I'm Going Through an Error in Public Class

0

Technically I'm afraid there is nothing wrong, but even though I do not have much knowledge on the subject, I would like to ask for help here, when the toastr function is executed, it presents me with an error that would be something as variable undefined in the lines where it has the $return .= in the toastr executed, summarizing independently that is the toastr error, success, or info it presents / displays the error mentioned.

public function scripts()
        {
            if (!empty($this->javascripts)) {
                $javascripts = array();
                foreach ($this->javascripts as $javascript) {
                    $javascripts[] = '<script src="' . $javascript . '"></script>';
                }
                $return = implode("\n", $javascripts) . "\n";
            }
            if (!empty($this->script)) {
                $return .= '<script>' . $this->script . '</script>';
            }
            if (!empty($_SESSION["success_msg"])) {
                $return .= '<script>toastr.success("' . $_SESSION["success_msg"] . '","SUCCESS!");</script>';
                unset($_SESSION["success_msg"]);
            }
            if (!empty($_SESSION["error_msg"])) {
                $return .= '<script>toastr.error("' . $_SESSION["error_msg"] . '","ERROR!");</script>';
                unset($_SESSION["error_msg"]);
            }
            if (!empty($_SESSION["info_msg"])) {
                $return .= '<script>toastr.info("' . $_SESSION["info_msg"] . '");</script>';
                unset($_SESSION["info_msg"]);
            }
            if (empty($return)) {
                return '';
            }
            return "\n" . $return;
        }
    
asked by anonymous 07.12.2018 / 15:51

0 answers