I have the following resource route:
Route::resource('pools', 'PoolsController');
I also have an edit form which should post to the controller's "update" method, set up like this:
{{ Form::open(array('route' => ['pools.update', $pool['id']])) }}
When I submit the form, it opens www.domain.com/pools/6 (6 being $pool['id']
above). However, instead of running the code in the update()
method, it throws an error:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
Now, I've found Laravel's error reporting very unhelpful so far, and this is no exception. The error description is vague at best and does nothing to help me troubleshoot the issue.
I was under the impression that the update method should receive post data automatically when using resourceful routing. It has also worked in some examples before, using the same syntax.
So, can anyone tell me what might be going on here?
to run the code in the update method, you must spoof a PUT request. look here: Form Method Spoofing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With