thephpleague / route

Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.
http://route.thephpleague.com
MIT License
651 stars 126 forks source link

how to use put or patch or delete method! #265

Closed matin-kh73 closed 4 years ago

matin-kh73 commented 4 years ago

I wanna use put method for update some data, I used a hidden input with put value and _method name and when I sending a request I faced an error with the method not allow exception! what should I do?

philipobenito commented 4 years ago

That method is a workaround as HTML forms don't natively support PUT/PATCH/DELETE, Route does not handle that for you by default, my suggestion would be to just use POST

matin-kh73 commented 4 years ago

because of my terms, I have to use it in this way. Is this package support this workaround? I try to add the hidden input in the body but finally, I faced the method not allow exception! regards.

philipobenito commented 4 years ago

No, Route doesn't support this by default, you could probably create a middleware to programmatically change the method on the request if that hidden input exists

-------- Original Message -------- On 27 Dec 2019, 16:02, Matin wrote:

because of my terms, I have to use it in this way. Is this package support this workaround? I try to add the hidden input in the body but finally, I faced the method not allow exception! regards.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.