我正在使用
在 web.php 中:
Route::post('/delete',[PostController::class,'destroy'])->name('post.delete');
&&
内部刀片模板:
<form method="POST" class="d-inline" action="{{route('post.delete')}}">
@csrf
<input type="hidden" name="slug" value="{{ $post->slug }}">
<button type="submit" class="btn px-0 d-inline">Delete</button>
</form>
问题是:当我点击删除按钮时抛出 404 异常
Github 存储库:https://github.com/Khokon-Chandra/Blog-Backend.git
答案 0 :(得分:0)
尝试使用:
Route:delete('/delete',[PostController::class,'destroy'])
并添加
@method('delete')
在@csrf
之后在你的刀片内