public function register($email, $ipAddress, $referrerCode = null, $isMobile = null, $extra = null) { if (Eloquents\User::where('email', $email)->first()) { throw new \Unflr\Exceptions\AlreadyRegistered(); } $this->email = $email; $this->orm = Eloquents\User::create(['email' => $email, 'ipaddress' => $ipAddress, 'referral_code' => $this->createReferralCode(), 'referred_by' => $referrerCode, 'unsubscribe_guid' => Str::random(24), 'has_mobile_registered' => $isMobile, 'coupon' => Str::random(10)]); // referrer notif if ($referrerCode) { $referrer = (new User())->findBy('referral_code', $referrerCode); $referrer->exists() and $referrer->addReferralSuccess(); } $this->sendWelcomeEmail(); return $this; }