Preview:
/**
* Controller Code
*/
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required|unique:categories'
]);

$category = new Category();

Category::create([
'name' => $request->name
]);

// create flash message to show success
// 
session()->flash('success', 'Category Successfully Created');

return redirect(route('categories.index'));
}

/**
* View Code
*/
<div class="container">
// if session has success message, display it
  @if (session()->has('success'))
    <div class="alert alert-success">
    	{{ session()->get('success') }}
    </div>
  @endif
</div>
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter