loading...

Laravel Flash Message

pakainfocom profile image pakainfo ・2 min read

When we work with laravel, we required to show/display alert notification success as well as error messages. Here you can understand the different method to show or display alert notification error or success bootstrap alert message in laravel projects for laravel bootstrap alert:

Laravel – Implement Flash/Alert Message Using Bootstrap

Flash messages is required in laravel project because that way we can give alter with what progress complete, error, warning etc. In this Article We added several method to give alert notification like redirect with laravel bootstrap alert in bootstrap Session-Based flash message, redirect with error message, redirect with warning message timeout as well as redirect with info Display Message. In this Tutorials and Courses we use bootstrap flash alert layout that method it set off great user friendly Page layout.

There are following alert will added:

Laravel success alert
Laravel error alert
Laravel warning alert
Laravel info alert
Laravel validation error alert
laravel bootstrap alert

resources/views/alert-notification.blade.php

if ($notification = Session::get('success'))

      
         $notification 

endif
if ($notification = Session::get('error'))

      
         $notification 

endif
if ($notification = Session::get('warning'))

      
    $notification 

endif
if ($notification = Session::get('info'))

      
    $notification 

endif
if ($errors->any())

      
   Please check the form under for errors

Use Flash Messages With Redirect

public function create(Request $request)
{
   $this->validate($request,[
        'title' => 'required',
        'details' => 'required'
        ]);
   $movies = Movie::create($request->all());
   return back()->with('success','Movies created successfully!');
}

also Full source code here : laravel bootstrap alert

Posted on by:

pakainfocom profile

pakainfo

@pakainfocom

My name is Angular King. I'm a full-stack developer, entrepreneur and owner of Pakainfo. I live in India and I love to write

Discussion

pic
Editor guide