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

RajeevElzrando's avatar

Encrypt and Decrypt id from javascript to laravel?

Javascript

window.location.href = "{{ url('student/take_test')}}/"+encrypted; javascript id passing above method. encrypt id in javascript

Laravel

decrypt in laravel

Route::get('/student/take_test/{id}', 'App\Http\Controllers\Student\StudentController@take_test') is that possible?

0 likes
3 replies
vincent15000's avatar

You can decrypt in Laravel any id that you have encrypted with Laravel.

Sinnbeck's avatar

how is it encrypted in javascript? There are A LOT of different types of encryption

1 like
newbie360's avatar

if you are doing on every request encrypt / decrypt , just use slug instead

1 like

Please or to participate in this conversation.