I need to encrypt routes in this URL? Because I do not want user to access URL by changing the item id. For example, user can change /items/1234 to /item/5678. Although item
You can encrypt your url parameter and decrypt it in your controller. You can try this:
In your view: Suppose your parameter is id or more parameter you can encrypt.
1,
];
$parameter= Crypt::encrypt($parameter);
?>
a link
Your route will be:
Route::get('/url/{parameter}', 'YourController@methodName');
In your controller, You can decrypt your parameter:
public function methodName($id){
$data = Crypt::decrypt($id);
}
You must be yous Crypt namespace in your top of controller
use Illuminate\Support\Facades\Crypt;
Note: You can encrypt url parameter with Crypt::encrypt($parameter) and decrypt with Crypt::decrypt($parameter)