0

I have tried several different methods with no success. I get a blank page. I want to redirect to a page after deleting a record from a controller. The Laravel docs say this; https://laravel.com/docs/8.x/routing#redirect-routes

Route::redirect('/here', '/there');

I have this

Route::redirect('customers', 'customer' ); 

I have also tried this, but get this error Route [customers] not defined.

return redirect()->route('customers');

The route in my web.php looks like this.

Route::get('/customers', [CustomersController::class, 'index']);
MSC
  • 55
  • 7
  • Can you add the code of your index method ? – Gazmend Sahiti Dec 05 '20 at 00:05
  • If you want to use `route()` helper, you need to name your route, like `Route::get('/customers', [CustomersController::class, 'index'])->name('customers.index');` – miken32 Dec 05 '20 at 00:36
  • Then you should use `return redirect()->route('customers.index');` as explained here: https://laravel.com/docs/8.x/responses#redirecting-named-routes – miken32 Dec 05 '20 at 00:44
  • I am not sure why this question was closed because all the other questions before do not answer this directly. I am still curious why the Laravel docs show the Redirect method and then it does not work. I also do not get the /here /there either. I assumed it from the page I am on to the page I want to go. – MSC Dec 07 '20 at 15:27
  • Thanks, miken32 because I have it redirecting now. – MSC Dec 07 '20 at 15:28

0 Answers0