Laravel: Route::resource() GET & POST work, but PUT & DELETE throw MethodNotAllowedHttpException
laravel, php, routes, url-routing
Solution
Solved! The answer can be found by running `php artisan routes`.
That showed me that DELETE and PUT/PATCH expect (require) a bar ID. I happened to be neglecting that because there can only be one of this particular type of "bar". The easy fix it to simply add it to my URL's regardless, like `project.dev/v2/foo/1234/bar/5678`.
Problem
I'm writing a webservice API (in laravel 4.2). For some reason, the routing to one of my controllers is selectively failing based on HTTP method. My routes.php looks like: ``` Route::group(array('prefix' => 'v2'), function() { Route::resource('foo', 'FooController', [ 'except' => ['edit', 'create'] ] ); Route::resource('foo.bar', 'FooBarController', [ 'except' => ['show', 'edit', 'create'] ] ); } ); ``` So, when I try any of GET / POST / PUT / PATCH / DELETE methods for the `project.dev/v2/foo` or `project.dev/v2/foo/1234` urls, everything works perfectly. But, for some reason, only GET and POST work for `project.dev/v2/foo/1234/bar`. The other methods just throw a 405 (MethodNotAllowedHttpException). (fyi, I am issuing requests via the Advanced Rest Client Chrome extension.) What's going on? What am I missing?