What I am trying to do is after a record has been deleted, redirect back to a certain page with a success message. The error that I am getting is that the redirect is causing a "405 method not allowed error". If I remove the redirect the delete works fine.
My Delete Method
public function destroy($id){
$customer = Customer::find($id);
$customer->delete();
return redirect()->route('customers.index')->with('success','Customer deleted');
}
Other Redirect Methods I've Tried
return redirect()->action('CustomerController@index')->with('success', 'Customer deleted');
redirect('pages.customers.index')->with('success', 'Customer deleted');
return redirect()->to('/customers')->with('success', 'Customer deleted')->send();
Route Configuration
Route::resource('customers', 'CustomerController');
My Index Method
public function index()
{
$customers = Customer::all();
return view('pages.customers.index', compact('customers'));
}
From what I've read on other posts, the wrong method is being used when redirecting, is there a way I can specify which method to use?
