public static function generateRandomPassword($length = 8, $customAlphabet = null)
    {
        $pass = [];
        if (strlen(trim($customAlphabet))) {
            $alphabet = trim($customAlphabet);
        } else {
            $alphabet = 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789';
        }

        $alphaLength = strlen($alphabet) - 1;
        for ($i = 0; $i < $length; $i++) {
            $n = rand(0, $alphaLength);
            $pass[] = $alphabet[$n];
        }

        return implode($pass);
    }