src/Messages.php
public function add($type, $message, $redirect = null)
    {
        if (!isset($type) or !isset($message[0])) {
            return false;
        }
        // Replace any shorthand codes with their full version
        if (strlen(trim($type)) === 1) {
            $type = str_replace(['h', 'i', 'w', 'e', 's'], ['help', 'info', 'warning', 'error', 'success'], $type);
        }

        $router = new Router();

        try {
            if (!in_array($type, $this->msgTypes)) {  // Make sure it's a valid message type
                throw new BaseException('"' . strip_tags($type) . '" is not a valid message type!', 501);
            }
        } catch (BaseException $e) {
            $msg = null;
            if (ini_get('display_errors') === "on") {
                $msg .= '<pre>';
                $msg .= 'Message: <b>' . $e->getMessage() . '</b><br><br>';

                $msg .= 'Accept: ' . $_SERVER['HTTP_ACCEPT'] . '<br>';
                if (isset($_SERVER['HTTP_REFERER'])) {
                    $msg .= 'Referer: ' . $_SERVER['HTTP_REFERER'] . '<br><br>';
                }

                $msg .= 'Request Method: ' . $_SERVER['REQUEST_METHOD'] . '<br><br>';

                $msg .= 'Current file Path: <b>' . $this->router->currentPath() . '</b><br>';

                $msg .= 'File Exception: ' . $e->getFile() . ':' . $e->getLine() . '<br><br>';
                $msg .= 'Trace: <br>' . $e->getTraceAsString() . '<br>';
                $msg .= '</pre>';

                return Response::create($msg)->display();
            }

            return Response::create($e->getMessage())->status(501)->display();
        }

        $get = $this->driver->get('flash_messages');
        $get[$type][] = $message;
        $this->driver->set('flash_messages', $get);

        if (!is_null($redirect)) {
            return $router->redirect($redirect, 301);
        }

        return true;
    }
public function add($type, $message, $redirect = null)
    {
        if (!isset($type) or !isset($message[0])) {
            return false;
        }
        // Replace any shorthand codes with their full version
        if (strlen(trim($type)) === 1) {
            $type = str_replace(['h', 'i', 'w', 'e', 's'], ['help', 'info', 'warning', 'error', 'success'], $type);
        }

        $router = new Router();

        try {
            if (!in_array($type, $this->msgTypes)) {  // Make sure it's a valid message type
                throw new BaseException('"' . strip_tags($type) . '" is not a valid message type!', 501);
            }
        } catch (BaseException $e) {
            $msg = null;
            if (ini_get('display_errors') === "on") {
                $msg .= '<pre>';
                $msg .= 'Message: <b>' . $e->getMessage() . '</b><br><br>';

                $msg .= 'Accept: ' . $_SERVER['HTTP_ACCEPT'] . '<br>';
                if (isset($_SERVER['HTTP_REFERER'])) {
                    $msg .= 'Referer: ' . $_SERVER['HTTP_REFERER'] . '<br><br>';
                }

                $msg .= 'Request Method: ' . $_SERVER['REQUEST_METHOD'] . '<br><br>';

                $msg .= 'Current file Path: <b>' . $this->router->currentPath() . '</b><br>';

                $msg .= 'File Exception: ' . $e->getFile() . ':' . $e->getLine() . '<br><br>';
                $msg .= 'Trace: <br>' . $e->getTraceAsString() . '<br>';
                $msg .= '</pre>';

                return Response::create($msg)->display();
            }

            return Response::create($e->getMessage())->status(501)->display();
        }

        $get = $this->driver->get('flash_messages');
        $get[$type][] = $message;
        $this->driver->set('flash_messages', $get);

        if (!is_null($redirect)) {
            return $router->redirect($redirect, 301);
        }

        return true;
    }
Add a message to the queue.

@param string $type     The type of message to add
@param string $message  The message
@param string $redirect (optional) If set, the user will be redirected to this URL

@return mixed