Laravel Route ::删除NotFoundHttpException

时间:2015-12-13 17:04:40

标签: php laravel laravel-5 laravel-5.1

我的某个表单上的DELETE请求会抛出NotFoundHttpException

路线:

itemsTypes = [ 'foo', 'bar' ]
Route::delete('{type}/{id}/delete', 'ItemTaxonomyController@destroy')
    ->where('type', $itemsTypes);

使用它的表格:

{!! Form::open( [action('ItemTaxonomyController@destroy', [$type, $item->item_id]), 'delete']) !!}
    <button type="submit">Delete</button>
{!! Form::close() !!}

1 个答案:

答案 0 :(得分:0)

您正在错误地打开表单。取代

{!! Form::open( [action('ItemTaxonomyController@destroy', [$type, $item->item_id]), 'delete']) !!}

{!! Form::open( [ 'url' => action('ItemTaxonomyController@destroy', [$type, $item->item_id]), 'method' => 'delete']) !!}