Sending data to view using redirect in Laravel?

2024-03-28 10:36:05 Anjani Kumar Laravel

You can send data to view using redirects in Laravel by using below code


$data=['id'=>1,'name'=>'test'];
return Redirect::route('Controller.method')->with('data' => $data);


Displaying controller data in Laravel view sent through Redirect.


// retrieving data
Session::get('data');


This post is submitted by one of our members. You may submit a new post here.

Related Tricks