How to return view with flash message in Laravel 6?

Today, We want to share with you How to return view with flash message in Laravel 6?.In this post we will show you Implement Flash Message with Laravel 6.2,, hear for Laravel 6 Implement Flash Messages with example we will give you demo and example for implement.In this post, we will learn about Laravel 6.0 Show flash error and success messages in different ways with an example.

How to return view with flash message in Laravel 6?

There are the Following The simple About print session message in laravel Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to use alert box in laravel 6 controller?, so the Inlining flash messages with the redirect() call in Laravel 6 is used for this example is following below.

print session message in laravel

in laravel Controller

return view('member-datalist.standardUser.includes.members')->with('members', $members)->with('successMsg','Team is updated .');

blade view files

  <div class="alert alert-success"> {{ $successMsg }}</div>

flash message in controller laravel 6

how to show error message in laravel blade

store functions in Laravel Controller

public function store(PostRequest $request) {
    if (Member::create($request->all())) {
        $request->session()->flash('activities.level', 'success');
        $request->session()->flash('activities.content', 'Member was successfully added!');
    } else {
        $request->session()->flash('activities.level', 'danger');
        $request->session()->flash('activities.content', 'Error!');
    return redirect('/');

In your blade file:

    <div class="alert alert-{{ session('activities.level') }}"> 
    {!! session('activities.content') !!}

How to use alert box in laravel controller 6?


return redirect()->back() ->with('success', 'Member Updated!');

    var msg = '{{Session::get('success')}}';
    var check = '{{Session::has('success')}}';

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel redirect with success message.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.