Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.

Home Page:http://lyften.com/projects/laravel-currency

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kwab opened this issue · comments

Using:

  • Laravel Framework version 4.2.11
  • PHP Version => 5.6.1 (on Windows)
  • MYSQL 5.6.21 (on Windows)
  • "torann/currency": "dev-master"

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'),
                ));
        }
}