Reputation: 218
I need to hide the url value in php as i have a booking site and users are able to edit their reservation through the URL if needed.
This is how the URL link looks like.
http://spiaggiasanmontano.it/booking/S12/2021-06-11/2021-06-12/0
i'm trying to remove the dates in the URL without breaking the code, any idea how i can do this?
And this is the route controller for it.
Route::get('/booking/{place_id}/{checkin}/{checkout}/{error_msg}', 'PagesController@createbooking')->name('user.createbooking');
Upvotes: 1
Views: 1007
Reputation: 15319
You can use laravel Encrypter
if you still wants to pass it in url with encrypted value instead of displaying orginal value
for example checkin date
pass encrypted date to url encrypt(checkin)
value
encrypt(checkin)
then in your controller you can decrypt it
$checkinDate= decrypt($checkin);
For example if have link like below in blade
<a href="{{route('user.createbooking',['palceid',encrypt($checkin)])}}"/>
Ref:https://laravel.com/docs/8.x/encryption#using-the-encrypter
Upvotes: 2