Model Data Types

Blueprint supports all of the available column types within Laravel. Blueprint also has a built-in column type of id. This is one of the model shorthands.

Some of these column types support additional attributes. For example, the string column type accepts a length, decimal accepts a precision and scale, and an enum may accept a list of values.

Within Blueprint, you may define these attributes by appending the column type with a colon (':') followed by the attribute value. For example:

payment_token: string:40
total: decimal:8,2
status: enum:pending,successful,failed

You may also specify modifiers for each column. Blueprint supports most of the column modifiers available in Laravel, including: autoIncrement, charset, collation, default, foreign, index, nullable, primary, unsigned, unique, and useCurrent.

Similar to the column type attributes, the foreign modifier also supports attributes. This is discussed in Keys and Indexes.

The column type and modifiers are separated by a space. While you may specify these in any order, it's recommend to specify the column type first, then the modifiers. For example:

email: string:100 nullable index