I have a problem changing data type column in my table, from double to decimal each (6,2).
Olso trying to $cast the variable to float, I’ve tried to cast olso as decimal, but nothing change, nothing change:
protected $cast = [ 'temperature' => 'float' ];
if I dd $this in my resource I got this:
The data back to be a number only if I rollback the data column type to double in mysql.
I’ve read about some problem in PDO driver, with myslq 5.2, but mine is 5.1.1
I’ve tried to print data without passing trough resource layer, but number are always served like string.
Advertisement
Answer
It should be :
protected $casts = [ 'temperature' => 'float' ];
Now you have typing mistake it should be $casts
in plural except $cast