Have you seen our video tutorials? Check 'em out!

Sending data in redirect not working

lckamal - 1 week ago

I am sending form data like this:

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

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

{{dump(data)}}

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 - 1 week 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 - 1 week ago

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