<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function(event) { 
        {% for flashMessage in app.session.flashbag.get('notice') %}
        var message = "{{ flashMessage }}";
        {% endfor %}
        if(typeof(message) !== "undefined"){
            var $toastContent = $('<span>'+message+'</span>');
            Materialize.toast($toastContent, 5000);
        }
    });
</script>