dimanche 29 octobre 2017

Encrypt ID in routers URL?

I have controllers like

Records, Items .... where I used ID /records/1, /records/2 .... /items/1, /items/2 .... Prompt the best variant at which it is possible to receive the cipher type of type / records / H $ Ur95% 92 (any hash) for all controllers (Records, Items ...). The first option was to create a table with the set id <-> hash and check the transmitted hash in the router. But I think this option is not quite right, because when adding a new record (ID), you need to record (check) the new hash. I think there is a simple option to do all this nicely through routers, without any additional tables. Like this

$id= Crypt::encrypt(['id' => 1 ]);
<a href="" target="_blank">get record</a>

And then check in router like

Route::get('/{id}', function($id){
 ..... Crypt::decrypt($id);............
});

Maybe find any other ways where we have global rules for all controllers to encrypt and decrypt IDs only in router area (without any guid/uuid).



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2loF89D
via IFTTT

Aucun commentaire:

Enregistrer un commentaire