0

Currently, when a customer adds a new patch, patch_id will be increased by one. However, this affects other customers as well. Say customer A adds a new patch, then the next patch customer B adds, will be an even higher ID.

I want to separate these, as i use the ID in the url, on a customer-basis. And i don't find it appropriate that a user will see patch/324 in his URL, if he's got only 3 patches. Each patch has a customer_id, equal to the corresponding customer.

How can i achieve this? I've been searching the internet far and wide, but i really don't know the proper way to express this question in short, to find a relative search-term.

StevenThelin
  • 235
  • 1
  • 3
  • 10
  • You'll probably need a customer-patch table with the auto increment on it. Or provide the patch number to the DB engine procedurally. See: http://stackoverflow.com/questions/26578313/how-do-i-create-a-sequence-in-mysql – N West Feb 11 '16 at 18:10
  • I think you are trying to solve a non-problem. What difference does it make what variables show up in the address bar? – Dan Bracuk Feb 11 '16 at 18:12
  • @DanBracuk I just don't want new customers to log into a personalized user interface, with a quite high patch ID in their URL. I want it to feel more unique – StevenThelin Feb 11 '16 at 18:14
  • Why don't you make a slug – Jamie Feb 11 '16 at 18:14
  • @NWest Cheers for the response. Useful link! I couldn't find anything usable myself, as i didn't know how to express this question. – StevenThelin Feb 11 '16 at 18:15
  • Add a `patch_id` field to your `customers` table and increment it manually or something like that. – AntoineB Feb 11 '16 at 18:16
  • Check out Hashids package this does a nice job to hide your system ids. You can use different recipes for the hash per model so your hashs are also internally unique – Mike Miller Feb 11 '16 at 20:34

0 Answers0