laravel back() no redirect preview page, redirecting to page /
Can you help me replicate this error in my machine?
I have a route
Route::post('/test/{id}/edit', 'TestController@test');
TestController
```
function test($id, Request $request) {
$validator = Validator::make($request->all(), [
'fieldname' => 'required',
]);
if ($validator->fails()) {
return back();
}
TestModel::find($id)->update($request->all());
return redirect('/test');
}
```
This works fine for me in my pc. Double-check your env as the documentation says
Since this feature utilizes the session, make sure the route calling the back function is using the web middleware group or has all of the session middleware applied.
its return redirect()->back();
Please ensure you review the documentation thoroughly.
Previous user could not replicate because one did not replicate failing the Validator.
I think both of return redirect()->back(); and return back(); do the same job. @yordadev
https://github.com/laravel/framework/blob/7ccf0cf63931a8d8391aed90e6fc011381ea6838/src/Illuminate/Foundation/helpers.php#L178
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
Most helpful comment
its
return redirect()->back();Please ensure you review the documentation thoroughly.
Previous user could not replicate because one did not replicate failing the Validator.