Search code examples
mysqllaraveleloquentartisan-migrate

Eloquent Mysql time type precision


I use Laravel 5.6.x framework, i have a connection on a Mysql database of which one of the tables contains a Time(6) field type.

sample value : '00:01:02.154120'

I want my model to receive the value with same precision but i always get a truncated value corresponding to 'H:i:s' format even i cast my column to datetime or string.

I created my table from migration and i saw Blueprint support well precision option for time type since version 5.5. So i guess there is a way to retrieve the whole value ?

How can i achieve this ?


Solution

  • This is a known problem: https://github.com/laravel/framework/issues/24214

    It's caused by a bug in PHP that will be fixed in 7.3: https://github.com/php/php-src/pull/3257