我正在特灵访问刀片模板上的路由,因此收到以下错误:
Route \[{$name}\] not defined.
Route::patch('/update_merchant/{merchant_id}', 'MerchantsController@update')->name('update');
刀片模板
<form name="merchants_data" id="merchants_data" method="post" action="{{route('update_merchant.update', [$item->merchant_id])}}">
{{ csrf_field() }}
{!! method_field('patch') !!}
控制器
public function update(Request $request, $merchant_id)
{
// Validation for required fields (and using some regex to validate our numeric value)
$request->validate([
'fees'=>'required',
]);
$merchants = Merchants_data::findorfail($merchant_id);
// Getting values from the blade template form
$merchants->fees = $request->get('fees');
$merchants->save();
return redirect('/manage_merchants')->with('success', 'Transaction Fee updated.');
}
3条答案
按热度按时间mspsb9vt1#
看起来你的路由名称是“更新”,但你调用“更新_商家.更新”
pxyaymoc2#
正如Mehran所说,您将路线命名为“update”,并在表单中调用了“update_merchant.update”。
这是您必须在
你不把URL放在“路由”资产中,只把名称放在其中。
yvt65v4c3#
您似乎已更改要更新的路由的名称...
你可以做的一件事是在你的命令行中转到项目的根目录..并查找
这将为您提供应用程序中当前拥有的所有路由的列表...