Chelsea Chelsea - 15 days ago 4
PHP Question

Redirect back to form with data in laravel

I have this function in the controller.

public function newsedit($id)
$editNews = $this->agro->find($id);
//return $editNews;
return Redirect::back()->with('editNews',$editNews);
//return View::make('')->with('editNews',$editNews);

The return $editNews displays data, so there is data in $editNews.Now i am trying to pass the same data to the view using redirect as shown in the above code.
But apparently the value is not passed. The following code shows the value is not availabel in the view

<h1> value availabel</h1>
<h1> No value </h1>

It displays No value . Please help me pass the data to view.I don't understant where have i gone wrong.


Laravel 4:


Laravel 5:


If you want to get the data, replace has() with get()