exists()) { // if exists, generate another code return $this->generateReferralCode(); } return $code; } }