Laravel 4 how to display flash message in view?

后端 未结 11 986
粉色の甜心
粉色の甜心 2021-02-04 00:33

I\'m trying to get my flash message to display.

This is in my routing file

Route::post(\'users/groups/save\', function(){

return Redirect::to(\'users/g         


        
11条回答
  •  隐瞒了意图╮
    2021-02-04 01:23

    when you set variable or message using ->with() it doesn't set the variable/message in the session flash, rather it creates an variable which is available in your view, so in your case just use $success instead of Session::get('success')

    And in case you want to set the message in the session flash the use this Session::flash('key', 'value'); but remember with session flash the data is available only for next request.

    Otherwise you can use Session::put('key', 'value'); to store in session

    for more info read here

提交回复
热议问题