Search code examples
phpflashlaravelflash-message

Setting display time of flash message in laravel 4.2


Normally in Laravel 4.2 when we create flash message by

Session::flash('message','This is flash message');

and display it by

Session::get('message'); 

It will disappear when we refresh the page.

The question is how could we set the display time of this flash message?

(For example: After 3 seconds, this message will disappear!).


Solution

  • This is how you would do it.

    $('div.alert').delay(3000).slideUp(300);
    

    change alert to whatever class you are using to display error message.