Laravel Redirect Back with() Message

laravellaravel-4laravel-5

I am trying to redirect to the previous page with a message when there is a fatal error.

App::fatal(function($exception)
{
    return Redirect::back()->with('msg', 'The Message');
}

In the view trying to access the msg with

Sessions::get('msg')

But nothing is getting rendered, am I doing something wrong here?

Best Answer

Try

return Redirect::back()->withErrors(['msg' => 'The Message']);

and inside your view call this

@if($errors->any())
<h4>{{$errors->first()}}</h4>
@endif