php - The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST. in laravel 7'

I am trying to use Resource Controller and having a problem with destroying method, can't find a solution.
I get this error
The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST.
web.php
Route::resource('honor', 'HonorController');
HonorController.php
public function destroy(Honor $honor)
{
dd($honor);
$honor->delete();
return redirect()->back();
}
blade
<form action="{{ route('honor.destroy', $honor->id) }}" method="post">
@csrf
@method('DELETE')
<div class="btn-group">
<a href="{{ route('honor.edit', $honor->id) }}" class="btn btn-info btn-sm">Edit</a>
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</div>
</form>
Answer
Solution:
Try changing the key (uses honor, not id) to match the name of the parameter in the route.
For example:
<form action="{{ route('honor.destroy', ['honor' => $honor->id]) }}" method="post">
@csrf
@method('DELETE')
<div class="btn-group">
<a href="{{ route('honor.edit', ['honor' => $honor->id]) }}" class="btn btn-info btn-sm">Edit</a>
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</div>
</form>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: filter_sanitize_string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.