buro71
buro71

Reputation: 9

Laravel 5.6 Flash Messages has to close automaticly

It's the first time I develop something and so the first time with laravel. Now I have made flash_error message and I want that those are closing after 3 seconds. Have no idea of how you do that.

This is the way I write then in my Controllers:

return redirect('/admin/settings')->with('flash_message_error', 'Incorrect Current Password!');

And this is the way I add then in my blade.php page:

@if(Session::has('flash_message_error'))
    <div class="alert alert-error alert-block">
        <button type="button" class="close" data-dismiss="alert">×</button> 
        <strong>{!! session('flash_message_error') !!}</strong>
    </div>
@endif 

Now the question how do I get then closed automaticlly and what I have to do for it

Upvotes: 0

Views: 1213

Answers (1)

Saddam
Saddam

Reputation: 1206

Use Jquery like

$("document").ready(function(){
    setTimeout(function(){
       $("div.alert").remove();
    }, 3000 ); // 3 secs

});

Upvotes: 2

Related Questions