我已经在我的刀片中使用了@method('PUT')
,但它仍然说不PUT
支持该方法,有人知道出了什么问题吗?
我的路线是:
这是我的车间控制器编辑参数和存储。
public function edit(Workshops $workshops)
{
$result = compact('workshops');
Json::dump($result);
return view('admin.workshops.edit', $result);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Workshops $workshops
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Workshops $workshops)
{
$this->validate($request,[
'name' => 'required|unique:workshops' . $workshops->id,
'datum' => 'required'. $workshops->id,
'plaatsen' => 'required' . $workshops->id,
'price' => 'required'
]);
$workshops->name = $request->name;
$workshops->datum = $request->datum;
$workshops->plaatsen = $request->plaatsen;
$workshops->price = $request->price;
$workshops->save();
session()->flash('success', 'The workshop has been updated');
return redirect('admin/workshops');
}
慕田峪7331174
ITMISS
慕丝7291255