public function clear(string $type = null): FlashBag
    {
        if (is_null($type)) {
            $this->messages = [];
        } else {
            if (isset($this->messages[$type])) {
                unset($this->messages[$type]);
            }
        }

        // Save into session
        $this->saveToSession();

        return $this;
    }
public function clear(string $type = null): FlashBag
    {
        if (is_null($type)) {
            $this->messages = [];
        } else {
            if (isset($this->messages[$type])) {
                unset($this->messages[$type]);
            }
        }

        // Save into session
        $this->saveToSession();

        return $this;
    }
public function clear ( string $ type = null ) : FlashBag { if ( is_null ( $ type ) ) { $ this -> messages = [ ] ; } else { if ( isset ( $ this -> messages [ $ type ] ) ) { unset ( $ this -> messages [ $ type ] ) ; } } // Save into session $ this -> saveToSession ( ) ; return $ this ; }
Clear messages in flash bag.

@param string $type Type of message

@return static
Clear messages in flash bag .