我在學習laravel,並且在調用delete方法時遇到問題。RouteCollection.php中的MethodNotAllowedHttpException第233行EveryThing是正確的,我認爲
我的路線:
Route::get('/', function() {
return view('inicio');
});
Route::resource('secciones', 'seccionesController');
我的形式:
{{ Form::open(['route' => ['secciones.destroy', $seccion->id], 'method' => 'DELETE']) }}
{{ Form::submit('Delete') }}
{{ Form::close() }}
的$ seccion-> ID是正確的,secciones.destroy(在seccionesController也有破壞法)是正確的。當我呼叫刪除拉拉維爾回報我:
MethodNotAllowedHttpException in RouteCollection.php line 233:
任何人都可以幫助我嗎?
在此先感謝..
試試'route('secciones.destroy',['id'=> $ seccion-> id])method =「Delete」' –
你的代碼看起來很好。嘗試使用'php artisan route:clear'清除路由緩存。如果它沒有幫助,請發佈'php artisan route:list'的結果' –