Right now I have a loop function to work until there are no matches in my database so that I could get a unique string. However, for some reason, my loop is infinite. Is there something I'm doing wrong here?
do {
$testvar = Str::random(5);
$data = User::where('password_url', 'LIKE', '%'.$testvar.'%')->get();
}
while (!empty($data));
The thing is that I do not get any error messages, but I dont get any results as well. Just to reiterate, if my array, $data is empty, I want this loop to be terminated, but if it exists, I want it to continue until it's empty.