Framework: laravel back() no redirect preview page, redirecting to /

Created on 25 Jul 2019  路  6Comments  路  Source: laravel/framework

laravel back() no redirect preview page, redirecting to page /

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.

All 6 comments

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.

https://laravel.com/docs/5.8/responses#redirects

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YannPl picture YannPl  路  3Comments

progmars picture progmars  路  3Comments

shopblocks picture shopblocks  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments

CupOfTea696 picture CupOfTea696  路  3Comments