public function register(TwoFactorAuthenticatable $user)
    {
        $key = env('AUTHY_KEY');

        $response = json_decode((new HttpClient)->post('https://api.authy.com/protected/json/users/new?api_key='.$key, [
            'form_params' => [
                'user' => [
                    'email' => $user->getEmailForTwoFactorAuth(),
                    'cellphone' => str_replace(['-', '.'], '', $user->getAuthPhoneNumber()),
                    'country_code' => $user->getAuthCountryCode(),
                ],
            ],
        ])->getBody(), true);

        $user->setTwoFactorAuthProviderOptions([
            'id' => $response['user']['id']
        ]);
    }
public function register(TwoFactorAuthenticatable $user)
    {
        $key = env('AUTHY_KEY');

        $response = json_decode((new HttpClient)->post('https://api.authy.com/protected/json/users/new?api_key='.$key, [
            'form_params' => [
                'user' => [
                    'email' => $user->getEmailForTwoFactorAuth(),
                    'cellphone' => str_replace(['-', '.'], '', $user->getAuthPhoneNumber()),
                    'country_code' => $user->getAuthCountryCode(),
                ],
            ],
        ])->getBody(), true);

        $user->setTwoFactorAuthProviderOptions([
            'id' => $response['user']['id']
        ]);
    }
public function register ( TwoFactorAuthenticatable $ user ) { $ key = env ( 'AUTHY_KEY' ) ; $ response = json_decode ( ( new HttpClient ) -> post ( 'https://api.authy.com/protected/json/users/new?api_key=' . $ key , [ 'form_params' => [ 'user' => [ 'email' => $ user -> getEmailForTwoFactorAuth ( ) , 'cellphone' => str_replace ( [ '-' , '.' ] , '' , $ user -> getAuthPhoneNumber ( ) ) , 'country_code' => $ user -> getAuthCountryCode ( ) , ] , ] , ] ) -> getBody ( ) , true ) ; $ user -> setTwoFactorAuthProviderOptions ( [ 'id' => $ response [ 'user' ] [ 'id' ] ] ) ; }
Register the given user with the provider.

@param  \Laravel\Spark\Contracts\Auth\TwoFactor\Authenticatable  $user
@return void
Register the given user with the provider .