How to Hide Id in Url in Laravel

Posted by

I want to hide id from URL, I have a database table that contains user_name, slug.

I’m using str_replace to remove any spaces in URL so if I used store/{slug} the parameters from url will not be the same as if I modified the url using str_replace.

Before:-

After :-

We are using code in Controller.

Result :-

Laravel Hide ID from url