mardi 18 octobre 2016

Laravel - Number with 4 decimals

I want to store 1 number with 4 decimals, in my database.

If i use float i can add only 2 decimals

$table->float('sell');

enter image description here


If I try with decimal i get an error

$table->decimal('sell', 1, 4);

The first number must be greater than or equal to the second number.

SQLSTATE[42000]: Syntax error or access violation: 1427 For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '  

sell'). (SQL: create table customers (id int unsigned not null auto_increment primary key, sell decimal(1, 4) not null,
created_at timestamp null, updated_at timestamp null) default character set utf8 collate utf8_unicode_ci)

Any help?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire