Friday, April 14, 2017

Laravel can't insert blank value into nullable DB field

I have a field in my database table called service_3_total which is of type decimal(10,2). I have set this to be a nullable() field in my migrations so in my database Null = Yes and Default = NULL.

If I leave this field blank when submitting my form I get the following error:

General error: 1366 Incorrect decimal value: '' for column 'service_3_total'

I have no idea why I'm getting this as I have allowed this field to be null in the database. I think it has something to do with the fact that it is a decimal data type.

Any Ideas?



via user3574492

Advertisement