Sending data in redirect not working
Created 7 years ago by lckamal

I am sending form data like this:

return redirect()->back()->with('data', \Request::all());

While checking the data from view lt's not working.


Sending errors is working fine though.

redirect()->back()->with('errors', $validator->errors()->all());

even this works:

redirect()->back()->with('errors', \Request::all());

Any thoughts?

ryanthompson  —  7 years ago

Data may very well be a reserved key in Laravel - I am not sure. If it works with errors and the same payload I would think you could use old or something too. Just not data (which is a common key in response information).

lckamal  —  7 years ago

I have tried with old too. In view it twig gives error when I do {{ old('fieldname') }} - Unknown "old" function.