private function register($socialUser)
    {
        $names    = explode(' ', $socialUser->getName());
        $username = is_null($socialUser->getNickname()) ? $socialUser->getEmail() : $socialUser->getNickname();

        $userDetails = [
            'username'     => $username,
            'email'        => $socialUser->getEmail(),
            'first_name'   => isset($names[0]) ? $names[0] : null,
            'last_name'    => isset($names[1]) ? $names[1] : null,
            'display_name' => $username,
        ];

        $user = User::create($userDetails);
        $user->assignRole(config('users.default'));
        $user->addSocial($socialUser, $this->driver);

        event(new UserRegistered($user));

        return $user;
    }
private function register($socialUser)
    {
        $names    = explode(' ', $socialUser->getName());
        $username = is_null($socialUser->getNickname()) ? $socialUser->getEmail() : $socialUser->getNickname();

        $userDetails = [
            'username'     => $username,
            'email'        => $socialUser->getEmail(),
            'first_name'   => isset($names[0]) ? $names[0] : null,
            'last_name'    => isset($names[1]) ? $names[1] : null,
            'display_name' => $username,
        ];

        $user = User::create($userDetails);
        $user->assignRole(config('users.default'));
        $user->addSocial($socialUser, $this->driver);

        event(new UserRegistered($user));

        return $user;
    }
private function register ( $ socialUser ) { $ names = explode ( ' ' , $ socialUser -> getName ( ) ) ; $ username = is_null ( $ socialUser -> getNickname ( ) ) ? $ socialUser -> getEmail ( ) : $ socialUser -> getNickname ( ) ; $ userDetails = [ 'username' => $ username , 'email' => $ socialUser -> getEmail ( ) , 'first_name' => isset ( $ names [ 0 ] ) ? $ names [ 0 ] : null , 'last_name' => isset ( $ names [ 1 ] ) ? $ names [ 1 ] : null , 'display_name' => $ username , ] ; $ user = User :: create ( $ userDetails ) ; $ user -> assignRole ( config ( 'users.default' ) ) ; $ user -> addSocial ( $ socialUser , $ this -> driver ) ; event ( new UserRegistered ( $ user ) ) ; return $ user ; }
Create a new user from a social user.

@param $socialUser

@return mixed
Create a new user from a social user .