我已经设置了在表单中插入数据的 POST 方法。我也在 web.php 中设置了 POST 方法。但每当我想通过表单插入数据时,它都会显示不支持 Get 方法。但我在表单和路由中都写了POST方法。这是我的代码:形式:<form action="{{url('/admin/prescription/store')}}" method="POST"> @csrfRoute::post('/admin/prescription/store','prescriptionController@store')->name('prescription.store');控制器:public function store(Request $request){ $prescription = new Prescription(); $prescription->full_name = $request->full_name; $prescription->nid = $request->nid; $prescription->address = $request->address; $prescription->contactNum = $request->contactNum; $prescription->health_cond = $request->health_cond; $prescription->desc = $request->desc; $prescription->save(); return redirect() ->route('prescription.store') ->with('success','Prescription added Successfully.'); }
- 3 回答
- 0 关注
- 100 浏览
添加回答
举报
0/150
提交
取消