I have seen many different implementations of this for different languages/frameworks, but I am wondering if Laravel might not have some useful helper methods that may make this an easier task.
In short, I would like to generate a random, unique string for each instance of a resource in my project. Let's say the resource is a 'test'. Upon test creation, I would like to assign it said string, with the end goal of being able to allow people to access a given resource based on this generated, unique value:
test.app/af3123!
test.app/gxcr_2!
I don't really care if they are all the same length or not, though I would prefer not to have something longer than say 6-8 characters.
At first glance I figured just to generate random combinations of strings, and test to see if such a combination has been used in the database yet. However, I imagine that might get problematic if the database becomes sufficiently large.
Any ideas?