private function updateFromGoogle($defaultCurrency)
    {
        $this->info('Updating currency exchange rates from finance.google.com...');
        foreach ($this->currency->getDriver()->all() as $code => $value) {
            // Don't update the default currency, the value is always 1
            if ($code === $defaultCurrency) {
                continue;
            }

            $response = $this->request('http://finance.google.com/finance/converter?a=1&from=' . $defaultCurrency . '&to=' . $code);

            if (Str::contains($response, 'bld>')) {
                $data = explode('bld>', $response);
                $rate = explode($code, $data[1])[0];
                
                $this->currency->getDriver()->update($code, [
                    'exchange_rate' => $rate,
                ]);
            }
            else {
                $this->warn('Can\'t update rate for ' . $code);
                continue;
            }
        }
    }
private function updateFromGoogle($defaultCurrency)
    {
        $this->info('Updating currency exchange rates from finance.google.com...');
        foreach ($this->currency->getDriver()->all() as $code => $value) {
            // Don't update the default currency, the value is always 1
            if ($code === $defaultCurrency) {
                continue;
            }

            $response = $this->request('http://finance.google.com/finance/converter?a=1&from=' . $defaultCurrency . '&to=' . $code);

            if (Str::contains($response, 'bld>')) {
                $data = explode('bld>', $response);
                $rate = explode($code, $data[1])[0];
                
                $this->currency->getDriver()->update($code, [
                    'exchange_rate' => $rate,
                ]);
            }
            else {
                $this->warn('Can\'t update rate for ' . $code);
                continue;
            }
        }
    }
private function updateFromGoogle ( $ defaultCurrency ) { $ this -> info ( 'Updating currency exchange rates from finance.google.com...' ) ; foreach ( $ this -> currency -> getDriver ( ) -> all ( ) as $ code => $ value ) { // Don't update the default currency, the value is always 1 if ( $ code === $ defaultCurrency ) { continue ; } $ response = $ this -> request ( 'http://finance.google.com/finance/converter?a=1&from=' . $ defaultCurrency . '&to=' . $ code ) ; if ( Str :: contains ( $ response , 'bld>' ) ) { $ data = explode ( 'bld>' , $ response ) ; $ rate = explode ( $ code , $ data [ 1 ] ) [ 0 ] ; $ this -> currency -> getDriver ( ) -> update ( $ code , [ 'exchange_rate' => $ rate , ] ) ; } else { $ this -> warn ( 'Can\'t update rate for ' . $ code ) ; continue ; } } }
Fetch rates from Google Finance

@param $defaultCurrency
Fetch rates from Google Finance