public function getMessages($key = null)
    {
        if (null !== $key) {
            return $this->flash->getMessage($key);
        }

        return $this->flash->getMessages();
    }
public function getMessages($key = null)
    {
        if (null !== $key) {
            return $this->flash->getMessage($key);
        }

        return $this->flash->getMessages();
    }
public function getMessages ( $ key = null ) { if ( null !== $ key ) { return $ this -> flash -> getMessage ( $ key ) ; } return $ this -> flash -> getMessages ( ) ; }
Returns Flash messages; If key is provided then returns messages
for that key.

@param string $key

@return array
Returns Flash messages ; If key is provided then returns messages for that key .