issaadi
3 years ago

redirect with message not working l5.2

Posted 3 years ago by issaadi

When I delete an item, the controller method (destroy) should do redirect (works) and showing the message sent with, but no message there !

controller method :

    $command = new DestroyJobCommand($id);
    $this->dispatch($command);
        return redirect()->to('/cms/jobs')->with('message', 'Item deleted successfully.');

Route:

    Route::group(['middleware' => ['web']], function () {
        Route::group(['prefix' => 'cms'], function(){
            //Route::get('/', 'CustomerController@index');
            Route::get('/', 'JobController@index');
            Route::get('/customers', 'CustomerController@index');
        
            Route::get('/jobs', 'JobController@index');
            Route::get('/materials', 'MaterialController@index');
        });
    });

In View:

@if(Session::has('message'))
          <div class="alert alert-info">
            {{ Session::get('message') }}
          </div>
 @endif

Please sign in or create an account to participate in this conversation.