// ValidationFormRequest.php
public function rules()
{
return [
'value' => 'required|numeric',
];
}
// web.php
$this->group(['middleware' => ['auth'], 'namespace' => 'Admin', 'prefix' => 'admin'], function(){
$this->get('transfer', 'BalanceController@transfer')->name('balance.transfer');
$this->post('confirm-transfer', 'BalanceController@confirmTransfer')->name('confirm.transfer');
$this->post('transfer', 'BalanceController@transferStore')->name('transfer.store');
});
// BalanceController.php
public function transfer()
{
return view('admin.balance.transfer');
}
public function confirmTransfer(Request $request, User $user)
{
// ...
return view('admin.balance.transfer-confirm', compact('sender', 'balance'));
}
public function transferStore(ValidationFormRequest $request)
{
// ...
}
当源表单在web.php中没有路由时,如何使用FormRequest进行验证?
错误发生在路由“ transfer.store”中:
Symfony \组件\ HttpKernel \ Exception \ MethodNotAllowedHttpException没有消息
谢谢您的帮助。.......