Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Hiding the params with a GET request

Hello,

I have to access to the gallery GET route.

I'd like to have to way access :

  • gallery to show the entire gallery
  • gallery with filters to access to the filtered gallery (for example type=my-super-type)

The usual way to do that is to write the params in the URL : http://localhost:8000/gallery?type=my-super-type.

Is it possible to use a GET route like http://localhost:8000/gallery without showing the params (but transfering the params) ?

Thanks for your help ;).

Vincent

0 likes
7 replies
Randy_Johnson's avatar

Yes, I am sure you can by using a POST request and using MVC.

php artisan make:model Photo -mcr

This Will create your model, migration and resource controller.

Route::resource('photo', PhotoController::class);

The route will create a resource route that you can check by php artisan route:list

Then you will use

In blade.

On my phone, bad writing. Hope this helps.

1 like
vincent15000's avatar

@tisuchi Ok ... I don't need to care about data, I just wanted to avoid to show the filters. Thank you very much ;).

rajeshtva's avatar

you are thinking is in incorrectly. The GET method is for passing filters & query parameters to server which will be visible in the browser address bar. you can't do anything to hide them using get method.

however @randy_johnson said you can use post method to send query parameters and filters to the server in the form of form field key-value pairs. This ways these fields will not be visible to anyone neither it will save in history. rest will be as it is.

1 like
Snapey's avatar
Snapey
Best Answer
Level 122

Please see one of my sites https://speakernet.co.uk/talks

When you change the filters on the top right, it does a POST to the database with the new filter setting. The controller stores this choice in session, then redirects to the GET route that shows the talks.

The Get route applies any filters that are in session before returning the list of talks.

Note that this is not perfect. If you open another browser tab, you will see that changes in one tab affect the other (since the session is shared between all open tabs)

vincent15000's avatar

@Snapey Hello ... thank you very much ... effectively it's really a good idea to use sessions, so it is possible to display the route without showing the params ;). Thanks.

Please or to participate in this conversation.