M
M
MasterCopipaster2020-07-09 11:54:14
Laravel
MasterCopipaster, 2020-07-09 11:54:14

Laravel how to resolve put request?

Hello everyone, who can tell me how to allow the put method in laravel without emulation?
I have this route

Route::resource('orders', 'OrderController')->except(['create', 'edit','update']);

But I am getting this error
The PUT method is not supported for this route. Supported methods: GET, HEAD, POST.

But the documentation states that I must send the http type to the PUT / PATCH resource to trigger the update event

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-07-09
@MasterCopipaster

You want something strange. All methods are listed in the documentation :

Verb		URI			Action		Route Name
GET		/photos			index		photos.index
GET		/photos/create		create		photos.create
POST		/photos			store		photos.store
GET		/photos/{photo}		show		photos.show
GET		/photos/{photo}/edit	edit		photos.edit
PUT/PATCH	/photos/{photo}		update		photos.update
DELETE		/photos/{photo}		destroy		photos.destroy

As you can see, the PUT method is only available for the update route, which you have explicitly disabled.
Next, you write
I make a PUT request for orders by default, it is disabled in the lara
This means that you are trying to create an entity, but for this you need to send a POST request, and again, this route is disabled for you. So this is not "by default it is disabled in the lara", but you removed it with your hands.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question