我有按钮删除
{!! Form::open([
'route' => ['articles.destroy', $art->id],
'method' => 'DELETE',
'class' => ''
]) !!}
<button type="button" class="delete btn btn-danger glyphicon glyphicon-trash"> DELETE</button>
{!! Form::close() !!}
我的路线:
Route::delete('/articles/delete/{id}', [
'as' => 'articles.destroy',
'uses' => 'ArticlesController@destroy'
]);
我的控制器:
public function destroy($id)
{
$article = Article::find($id);
$article->delete();
}
我的问题是当我点击删除按钮时它没有做任何事情
答案 0 :(得分:0)
必须提交表格以致电路线。为此,您应将type="button"
更改为type="submit"
。