Schema Builder length of an integer
If you're using MySQL, you can't specify the length of an integer column. You can only choose between one of the available integer types, described at http://dev.mysql.com/doc/refman/5.1/en/integer-types.html.
Hence, you cannot set the integer length in Laravel either.
You can only choose one of the available types described at Laravel 4.2 Database Migration Creating Column.
Thought I'd create an easy-to-copy-and-paste for general situations table.
Signed if you do require negative values and unsigned if you do not.
| Type | Eloquent (Schema Builder) | Min | Max | | ------------------- | ----------------------------------------- | ------- | ------ | | TINYINT (Signed) | $table->signedTinyInteger('foo') | -128 | 127 | | TINYINT (Unsigned) | $table->unsignedTinyInteger('foo') | 0 | 255 | | SMALLINT (Signed) | $table->signedSmallInteger('foo') | -32768 | 32767 | | SMALLINT (Unsigned) | $table->unsignedSmallInteger('foo') | 0 | 65535 |
For larger Integer types, see: https://dev.mysql.com/doc/refman/5.5/en/integer-types.html
I'm guessing that you want to specify a length of 10 to match an increment id (when declaring foreign keys). If so then you have to use:
$table->unsignedInteger('some_id_reference');