我在RouteCollection.php中获得了MethodNotAllowedHttpException

我在RouteCollection.php中获得了MethodNotAllowedHttpException,php,laravel,Php,Laravel,我在RouteCollection.php 这里是service.blade.php <form ACTION="{{ url('backend/client/updateservice' ) }}" METHOD="POST" id="form1" name="form1" > <input type="hidden" name="_token" value="{{ csrf_token() }}"> </form> 这里是ClientCo

我在
RouteCollection.php

这里是service.blade.php

<form ACTION="{{ url('backend/client/updateservice' ) }}" METHOD="POST" id="form1" name="form1" >
   <input type="hidden" name="_token" value="{{ csrf_token() }}">     
</form>
这里是ClientController.php

public function editservice()
{
  $client = Client::where('ClientID','1') -> get() -> first();
  return view('backend/client.service',compact('client'));
}

public function updateservice()
{
  $clientUpdate = Input::all();
  $client = Client::where('ClientID','1') -> get() -> first();
  $client ->update($clientUpdate);
  return redirect('backend/client/service');
}

您可以使用
to
而不是
url

<form ACTION="{{ URL::to('backend/client/updateservice') }}" METHOD="POST" id="form1" name="form1" >
使用
route()
helper函数:

<form ACTION="{{ URL::route('updataService') }}" METHOD="POST" id="form1" name="form1" >

您可以使用
而不是
url

<form ACTION="{{ URL::to('backend/client/updateservice') }}" METHOD="POST" id="form1" name="form1" >
使用
route()
helper函数:

<form ACTION="{{ URL::route('updataService') }}" METHOD="POST" id="form1" name="form1" >


问题在于
更新服务
方法的
重定向
选项。将
updateservice
方法更改为此

public function updateservice()
{
  $clientUpdate = Input::all();
  $client = Client::where('ClientID','1') -> get() -> first();
  $client ->update($clientUpdate);
  return redirect('backend/client/editservice');
}

因为当它重定向时,它找不到重定向的路由

问题在于
更新服务
方法的
重定向
选项。将
updateservice
方法更改为此

public function updateservice()
{
  $clientUpdate = Input::all();
  $client = Client::where('ClientID','1') -> get() -> first();
  $client ->update($clientUpdate);
  return redirect('backend/client/editservice');
}

因为当它重定向时,找不到重定向的路由

请尝试将方法名称更改为getEditservice和postUpdateservice,以及在路由中。请检查表单提交的完整错误,然后检查路由中该URL的方法。尝试将方法名称更改为getEditservice和postUpdateservice,以及在路由中。请检查表单提交的完整错误,然后检查路由中该URL的方法。不,不可能,它不在方法体中,只有当它找不到任何方法时才会发生异常不,不可能,它不在方法体中,只有当它找不到任何方法时才会发生异常第二个更好,您可以为您的RouteEyes定义一个名称我确信请尝试第二个更好,您可以为您的RouteEyes定义一个名称我确信请尝试