Why is id() function in migration instead of bigIncrements() by default in a migration file?

I’ve been watching a tutorial on Laravel and there is $table->bigIncrements(“id”) in a migration file, but when I open the same file there is $table->id() function.

Questions:

  1. Was there any update in which bigIncrements was replaced by id()? I’ve been searching the net for a while but haven’t found anything about it.

  2. Do these functions do the same? Is there any difference between them?

Answer

When you are in doubt like that, always go to the source of truth… In this case it is open source, so go to GitHub and look for yourself… This is what all devs do…

So, if you look at Laravel 6.x, they used bigIncrements, but if you look on Laravel 7.x+, you will see they use id now…

More info on the Framework source code