【发布时间】:2019-08-24 21:47:57
【问题描述】:
我的删除功能不起作用,条目没有从数据库中删除,我收到的错误是:
抱歉,找不到您要查找的页面。
感谢您的帮助。
查看:
{{ Form::open(['method' => 'DELETE','route' => ['fields.destroy', $data[$i]->id]]) }}
{{ Form::submit('Usuń wpis', ['class' => 'btn btn-danger','data-toggle'=>'confirmation']) }}
{{ Form::close() }}
控制者:
public function destroy($id) {
DB::table('fields')->where('id', $id)->delete();
var_dump('co tam');
exit;
return response()->json(['success' => "Product Deleted successfully.", 'tr' => 'tr_' . $id]);
}
路线:
Route::get('/home/twojedzialki', 'twojedzialkiController@index')->name('twojedzialki.index');
Route::delete('/home/twojedzialki/{$id}', 'twojedzialkiController@destroy')-> name('fields.destroy');
但这有效:http://127.0.0.1:8000/home/twojedzialki/4
我知道该 ID 有效。
感谢您帮助我找到问题的根源。
【问题讨论】:
-
再次检查您的格式...它看起来像
return response()->json(['success' => "Product Deleted successfully.".....下方的消息