Support the ongoing development of Laravel.io →
Requests Input Views
Last updated 9 months ago.
0

Don't use POST for filtering, use GET parameters.

Last updated 9 months ago.
0

Whats wrong with using post? I don't want to create a url with ids and or data in it.

Last updated 9 months ago.
0

Your Route::any is catching the POST to /objectives and sending any type of request (GET,POST,PUT,PATCH,DELETE) to the index method.

When using resourceful controllers (which you are by doing Route::resource) your /objectives/create route should be POSTing to /objectives. This is why you will have an issue using POST for filtering instead of get.

If you want to do restful controllers use Route::controller instead. Then you can use getIndex, postIndex, etc.

Resourceful Controllers vs Restful Controllers

Last updated 9 months ago.
0

tpbsv77 said:

Whats wrong with using post? I don't want to create a url with ids and or data in it.

Don't you think filtering with GET gives you more control? You may use these URLs to make shortcuts in your app. Just a personal opinion.

Last updated 9 months ago.
0

My question was what is wrong with using Post? I have no problem using get but in some instances I don't need to pass all that data like that. So I was looking more for how do I solve the issue using POST as I was going in a circle.

Last updated 9 months ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

tpbsv77 tpbsv77 Joined 12 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.