Reputation: 741
I have seen on the web some people adding true
to the increments method whilst creating migrations. What does this do?
According to the offical Laravel 4.2 api, increments only accepts the field name as a string:
Fluent increments(string $column)
Create a new auto-incrementing integer column on the table.
Parameters
string $column
Return Value
Fluent
Upvotes: 1
Views: 335
Reputation: 15220
As the documentation says, the increcemnts
-method accepts only one argument which is the name of the column.
But increments($column)
is only a shortcut for unsignedInteger($column, true)
, where the second argument specifies whether the column should be auto-incremented. So you probably just confused them.
Don't forget that Laravel is open source, so whenever you're not sure about how something works under the hood, just have a look at the source code.
Upvotes: 4