app/FlashMessages.php
public static function getMessages(): array
    {
        $messages = Session::get(self::FLASH_KEY, []);
        Session::forget(self::FLASH_KEY);

        return $messages;
    }
public static function getMessages(): array
    {
        $messages = Session::get(self::FLASH_KEY, []);
        Session::forget(self::FLASH_KEY);

        return $messages;
    }
public static function getMessages ( ) : array { $ messages = Session :: get ( self :: FLASH_KEY , [ ] ) ; Session :: forget ( self :: FLASH_KEY ) ; return $ messages ; }
Get the current messages, and remove them from session storage.

@return stdClass[]
Get the current messages and remove them from session storage .