Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
http://lyften.com/projects/laravel-currency
BSD 2-Clause "Simplified" License
392 stars 137 forks source link

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'value' at row 1 #25

Closed kwab closed 8 years ago

kwab commented 9 years ago

Using:

Resolved by converting value to a number on line 103

// Update each rate
foreach ($lines as $line)
{
   $code = substr($line, 4, 3);
   $value = substr($line, 11, 6) * 1.00; //force conversion to number

   if ($value)
        {
            $this->app['db']->table($this->table_name)
                ->where('code', $code)
                ->update(array(
                    'value'         => $value,
                    'updated_at'    => new \DateTime('now'),
                ));
        }
}
Torann commented 8 years ago

Added https://github.com/Torann/laravel-currency/commit/5749a59b8eee72a60dd0cb899e8f40c48e41fe7b