Laravel redirect with data not working
laravel, laravel-blade, php
Solution
Since the with method flashes data to the session, you may retrieve the data using the typical `Session::get` method.
So you have to get as
$message = Session::get('message');
Problem
My application is a simple CRUD application. I have a delete controller action which redirects back to the list when the item is successfully deleted. What I'm trying to add now is a message to the user that the data was successfully deleted. My Controller Action: ``` public function deleteItem($id) { try { $item = Item::findOrFail($id); $item->delete(); return Redirect::to('list')->with('message', 'Successfully deleted'); } catch (ModelNotFoundException $e) { return View::make('errors.missing'); } } ``` The part of my list.blade.php view where I try to display the message: ``` @if (isset($message)) <div class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ $message }} </div> @endif ``` The problem that I have is that the `$message` variable is always empty ..