exists()) { return $id; } $attempts++; } // If we get here, try a completely random string as fallback return Str::random(10); } }