我想使用带有url的delete方法从数据库表中删除所有内容:
Route::post('delete','receiptcontroller');
但是我收到一条错误的无效路线操作:
[App\Http\Controllers\receiptcontroller]
视图:
<form action="{{ url('delete') }}">
<input type="submit" value="delete" class="btn-danger btn-lg">
</form>
和方法:
public function delete() {
receipt::truncate();
}
答案 0 :(得分:1)
尝试一下:
Route::post('/delete','receiptcontroller@delete');