'MethodNotAllowedHttpException The DELETE method is not supported in Laravel
I created a project using Laravel 8, and I made a blade/view to delete records from the database, but the error appeared when I clicked on the delete button.
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The DELETE method is not supported for this route. Supported methods: POST
Blade/view
<form action="{{ route('destroy', $steps->id) }}" method="POST">
<a class="btn btn-info" href="">Show</a>
<a class="btn btn-primary" href="{{ route('steps',$steps->id) }}">Edit</a>
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
Controller
public function destroy(Step $step)
{
$step->delete();
return redirect()->route('show');
}
Route
Route::post('destroy', [LinkController::class, 'destroy'])->name('destroy');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
