Laravel Resource Routing - "Method Not Allowed" Update Error

I have the following resource route:

Route::resource('pools', 'PoolsController'); 

I also have an editing form, which should be published in the controller's "update" method, configured as follows:

 {{ Form::open(array('route' => ['pools.update', $pool['id']])) }} 

When I submit the form, it opens www.domain.com/pools/6 (6 is located $pool['id'] above). However, instead of running the code in the update() method, it throws an error:

 Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException 

Now I have found that the Laravel error message is very useless so far, and this is no exception. The description of the error is uncertain at best and nothing helps me solve the problem.

I had the impression that the update method should automatically receive messages after using resourceful routing. It also worked in some examples before, using the same syntax.

So can anyone tell me what could be here?

+5
source share
1 answer

To run the code in the update method, you must trick the PUT request. see here: Ways to create forms

+5
source

Source: https://habr.com/ru/post/1233859/


All Articles