PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 13, 2022

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

 April 13, 2022     database-migration, laravel, migration, php     No comments   

Issue

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?


Solution

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...



Answered By - matiaslauriti
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing