Laravel 4.2 - 405 Method Not Allowed

2

I have a route that was working normally and stopped working for no apparent reason. It has the following configuration:

Route::put('/clientes', 'Clientes@update');

The error I get is:

Method Not Allowed
The requested method PUT is not allowed for the URL /clientes/.

If I simply modify the url to:

  

/ any-thing

It works normally, someone can explain this problem, because it does not make sense to me. When I run the "php artisan routes" command the route is there, but I always get this error. Can someone give me a light?

Note: I already have several routes working in these patterns.

    
asked by anonymous 04.11.2015 / 10:20

1 answer

2

In order to access the PUT method, it would be necessary that the request made to this url was also of type PUT . This request can not be made via form, only via ajax . Forms

The method not allowed is being returned because it is not an accepted method; that is, you are making a request of another type, when the expected type is PUT .

There is a problem that my fellow programmer has warned me is that if you also access url with a / at the end, the request is recognized as GET . Try removing the bar from the end of the requested url.

The requests made by a browser are usually of type GET .

This was not specified in the question: Whether the request was made by the browser or not.

    
04.11.2015 / 11:29