Search code examples
phplaraveltoastmaterializeflash-message

Flash Message Laravel 5.2 using toast materialize


can you help me solve this problem ? so in this case i want to show flash message in the next page after button click & action (save, update, delete) success perform...

i've read this https://www.tutorialspoint.com/materialize/materialize_dialogs.htm and also http://materializecss.com/dialogs.html but idk how to use it in my controller

public function hapuskeluhan($id){

    $keluh = keluhan::findOrFail($id);
    $keluh->delete();                
    return redirect('lihatkeluhan');
}

For Example is function delete, how could my toast appear before it redirect ? or maybe after ? please kindly help me brother


Solution

  • Try this

    @if(session('message'))
            <script>
              Materialize.toast("{{ @session('message') }}", 5000);  
            </script>
    
            @endif