我正在使用laravel框架。它说此路由不支持POST方法。支持的方法:GET,HEAD

时间:2019-11-26 07:47:27

标签: php laravel-blade laravel-5.8

表单中的Post方法可以在本地运行,但是当我将相同的代码克隆到VM时,它将无法正常工作。

Route::get('AnswerType/Save','Admin\AnswerTypeController@store'); //route

{!! Form::open(['url' => '/master-data/AnswerType/', 'method'=>'POST', 'class' => 'form-horizontal']) !!} //form

public function store(Request $request) //controller
{
    // validate
    request()->validate([
        'form.AnswerTypeName' => ['required', 'max:250'],
    ]);

    // save
    $security_group = AnswerType::create($request->form);

    // msg
    session()->flash('message-success', 'The Answer type was successfully created.');

    // redirect
    return redirect('/master-data/AnswerType/View');
}

0 个答案:

没有答案