消息未显示在路由重定向上

时间:2016-05-11 22:24:58

标签: php laravel

为什么我重定向我没有得到我的成功消息我想要它以便我可以改变警告" var":

HTML:

<div class="flash-message">
    @foreach(['warning', 'success'] as $flashMsg)
        @if(Session::has('alert-' . $flashMsg))
            <p class="alert alert-{{ $flashMsg }}">{{Session::get('alert-' . $flashMsg)}}</p>
            @endif
    @endforeach
</div>

控制器:

   return redirect()->route("newUser")->with('alert-success', $fName . $lName . 'Was Successfully Added');

路线:

Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => 'web'], function() {

    /* Admin Auth */
    Route::get('login', 'Auth\AuthController@getLogin');
    Route::post('login', 'Auth\AuthController@postLogin');
    Route::get('register', 'Auth\AuthController@getRegister');
    Route::post('register', 'Auth\AuthController@postRegister');
    Route::get('logout', 'Auth\AuthController@getLogout');

  Route::group(['middleware' => 'auth.admin'], function(){
    /*Admin Dashboard Routes */
        Route::get('dashboard', 'AdminController@getDashboard');
        Route::get('admin', 'AdminController@getDashboard');
        Route::get('general/settings', 'AdminController@generalSettings');

        Route::get('users', 'UserController@getDashboard');
        Route::get('users/new',['as' => 'newUser', 'uses' => 'UserController@addNewUser']);

        Route::post('users/new/add', 'UserController@addNewUserSubmit');

        Route::post('general/settings/gSubmit/{id}',['as' => 'generalDataSubmit',      'uses' => 'AdminController@generalSettingsGeneralSubmit']);
        Route::post('general/settings/sSubmit/{id}',['as' => 'socialDataSubmit',       'uses'  => 'AdminController@generalSettingsSocialSubmit']);
        Route::post('general/settings/vSubmit/{id}',['as' => 'verificationDataSubmit', 'uses' => 'AdminController@generalSettingsVerificationDataSubmit']);


    });
});

0 个答案:

没有答案