【发布时间】:2020-04-23 06:39:14
【问题描述】:
请问我找不到问题出在哪里!
刀片
<form action="/profile/{{$user->id}}" enctype="multipart/form-data" method="post">
@csrf
@method('patch')
路线
Route::patch('/profile/{user}', 'ProfilesControler@update')->name('profile.update');
错误:
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException 此路由不支持 GET 方法。支持的方法: 补丁。
编辑 1- web.php
Route::get('/', function () { return view('welcome'); });
Auth::routes();
Route::get('/p/create','postsController@create');
Route::get('/p/{posts}','postsController@show');
Route::post('/p','postsController@store');
Route::get('/profile/{user}/edit', 'ProfilesControler@edit')->name('Profile.edit');
Route::get('/Profile/{user}', 'ProfilesControler@index')->name('Profile.show');
Route::post('/profile/{user}', 'ProfilesControler@update')->name('profile.update')
【问题讨论】:
-
确保您提交的是该表单,而不是另一个包裹该表单的表单
-
嗨 Alberto,我的 edit.blade.php 上只有一个表单,我在 creat.blade.php 上有另一个表单,但它使用的是另一条路径,我疯了,我丢失了一个 dat试图修复它!希望你能帮助我
-
你会在这里分享整个
web.php文件吗! -
一定要加载这个视图,而不是另一个视图...还要检查浏览器中的源文件,以使用 @method 指令检查 laravel 在页面中的回显