【Controller.php】
public function destroy(Post $post)
{
$post->delete();
return redirect()
->route('posts.index');
}
【show.blade.php】
<form method="post" action="{{ route('posts.destroy', $post) }}">
@method('DELETE')
@csrf
【routes/web.php】
Route::delete('/posts/{post}/destroy', [PostController::class, 'destroy'])
->name('posts.destroy')
->where('post', '[0-9]+');
参考:ドットインストール『Laravel 8入門 CRUD処理編』