Valet and eloquent casts

Posted 3 years ago by alex_time

I've got a very strange behavior using valet yesterday. I have a decimal type on my DB (maria Db), not unsigned, representing a money value (with 4 decimals) when I access it through the eloquent model (without any casts) the value will be converted to string but I can, anyway, make only some math operation on it. If I make a subtraction to that value it works only until the result it is zero, it won't go below zero. So I tried to casts to a float on eloquent model, var_dump says the type it is still string and if I make a subtraction still I can't go below zero... Another strange behavior is that if I echo out a negative decimal DB value on blade (always accessing it through the eloquent model) all negative numbers will be printed between parenthesis and not wight the minus sign. My locale is set to "it" and the fallback to "en". What it's more strange is that if I run the very same project using homestead and not valet all works fine (subtraction will go below zero, negative number will be represented with minus sign, etc) and all without having to use the casts definition. Does anyone has ever experienced something like this?!

Please sign in or create an account to participate in this conversation.