我已经设置了在表单中插入数据的 POST 方法。我也在 web.php 中设置了 POST 方法。但每当我想通过表单插入数据时,它都会显示不支持 Get 方法。但我在表单和路由中都写了POST方法。这是我的代码:
形式:
<form action="{{url('/admin/prescription/store')}}" method="POST">
@csrf
Route::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.');
}
炎炎设计
阿波罗的战车
慕容3067478