When a new user is registered through the registration form of Laravel framework, the id
given to this new user is not the next id that exists in table users
.
To give you an example, take a look to the next picture:
The id of the new registered user should be 6, and not 22.
What I assume is that for testing purposes I already have deleted some users from table users
and that maybe the reason of the gap of ids.
Any ideas how to fix this?
CodePudding user response:
Ids will not get reused, id column is using auto_increment by default
1 - user 1
2 - deleted
3 - deleted
4 - new user // new user will get id 4 not 2
if you manually delete users when doing your tests you should reset auto_increment
example with phpmyadmin
there is a AUTO_INCREMENT field you need to reset to the value you want