Passing data on a redirect will make it available to the controller that handles the request after redirecting, you'll need to pass the data into the view from that controller.
Redirect::to passing variable to view
I have need to send some data back to the view from a function that returns this:
return Redirect::to($request->input('success_url'));
I have tried using ->with but I always get the error $donation is not defined
I also tried compact but same issue
return Redirect::to($request->input('success_url'), compact('donation',[$res]));
Is there a way to return data back so i can use it in my view.
The data flashed to the session will be available using session('data') or session()->get('data')
You will hit a controller method (presuming one is set up for URI), so you could assign to a variable in the controller; or you could use the session() helper directly in the view
Please or to participate in this conversation.