lundi 1 février 2016

Get the value of REDIRECT using WITH in laravel

we are trying to get the value sent with the redirect method in blade template in laravel.

Here is how my return statement looks like:

public function movetotrash($id){

    $page = Pages::where('id', $id) -> first();
    $page -> active = 0;
    //$page -> save();
    //return redirect()->route('pages.index')->with('trash','Page Moved To Trash');
    return redirect('pages')->with('trash','Page Moved To Trash');
}

Now once its redirect to pages it creates are URL like this http://localhost:8888/laravelCRM/public/pages.

Then i want to print the message to user that "Page is moved to trash" with $trash variable. For which i used this :

@if(isset($trash) ))
                       <div class="alert alert-error">
                          {{ $trash }}<br><br>
                       </div>
                    @endif

What should i do to print the value?

Thank you! (in advance)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire