I know there are many posts about this one, but there are a few things that none of them answered so far. Not here or on the Laracast forum.
No.1: What is the best practice to do this? I saw couple different ways of doing this. Should I set it in Model or in the Controller? Is there an automated way or it's just PHP str_random(6)
function?
No.2: How to approach the possibility that the newly generated key could be a duplicate? Do I have to check it manually? I know that Laravel will throw the crap error if you tried to enter a duplicate in DB and I don't want that kind of an error on the live application.
No3: Will it slow down the application speed? My guess is if it has to check for duplicates, if the DB is large, it would be slow.
No.4: Should this even be done? I want to give this key to customers on the site, as their transaction key, for example. I don't want to know them how may of transactions there were before their one or give them any info regarding that. Security reasons.
I could guess answers, but I'm not 100% sure. If anyone has done this, I would appreciate any answers.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire