【发布时间】:2020-08-19 13:50:19
【问题描述】:
这就是我的代码的样子
路线:
Route::put('/articles/{$article}', 'ArticlesController@update');
控制器:
public function update($id){
$article=Article::find($id);
$article ->title = request('title');
$article->excerpt=request('excerpt');
$article->body=request('body');
$article->save();
return redirect('/articles/'. $article->id);
}
刀片:
<form method="POST" action="/articles/{{$article->id}}" >
@csrf
@method('PUT')
每次我尝试提交更新时都会收到以下信息:
The PATCH method is not supported for this route. Supported methods: GET, HEAD.
我目前卡在这个上。
【问题讨论】:
-
请分享与
articles相关的所有路线。你在使用 resource() 路由吗