protected function generateReferral()
    {
        Factory::helper('string');
        $oDb       = Factory::service('Database');
        $sReferral = '';

        while (1 > 0) {

            $sReferral = random_string('alnum', 8);
            $oQuery    = $oDb->get_where($this->table, ['referral' => $sReferral]);

            if ($oQuery->num_rows() == 0) {
                break;
            }
        }

        return $sReferral;
    }
protected function generateReferral()
    {
        Factory::helper('string');
        $oDb       = Factory::service('Database');
        $sReferral = '';

        while (1 > 0) {

            $sReferral = random_string('alnum', 8);
            $oQuery    = $oDb->get_where($this->table, ['referral' => $sReferral]);

            if ($oQuery->num_rows() == 0) {
                break;
            }
        }

        return $sReferral;
    }
protected function generateReferral ( ) { Factory :: helper ( 'string' ) ; $ oDb = Factory :: service ( 'Database' ) ; $ sReferral = '' ; while ( 1 > 0 ) { $ sReferral = random_string ( 'alnum' , 8 ) ; $ oQuery = $ oDb -> get_where ( $ this -> table , [ 'referral' => $ sReferral ] ) ; if ( $ oQuery -> num_rows ( ) == 0 ) { break ; } } return $ sReferral ; }
Generates a valid referral code

@return string
Generates a valid referral code