I am new to laravel and I am trying to create a user database. But I am getting an error message regarding my ID column even though I set it to autoincrement.

Here is my migration
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('ID');
$table->string('FirstName');
$table->string('LastName');
$table->string('Email')->unique();
$table->string('Password');
$table->timestamps();
});
DB::statement('ALTER TABLE `users` MODIFY `ID` INT(10) ZEROFILL;');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
};
I haven’t done anything yet in the model so it’s still at default
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Users extends Model
{
use HasFactory;
}
Here is my POST method
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Users;
use Illuminate\Support\Facades\Hash;
class UserAuthController extends Controller
{
public function registerUser(Request $request) {
$request -> validate([
'firstname' => 'required',
'lastname' => 'required',
'email' => 'required|email|unique:users,Email|confirmed',
'password' => 'required|min:8|max:25|confirmed'
]);
$user = new Users();
$user -> firstname = $request -> firstname;
$user -> lastname = $request -> lastname;
$user -> email = $request -> email;
$user -> password = Hash::make($request -> password);
$res = $user -> save();
if($res) {
return back() -> with('success', 'You are now registered!');
}
else {
return back() -> with('failed', 'Registration failed!');
}
}
}
Here is my signup form
<div class="container form__container">
<form action="{{ route('auth.user.reguser') }}" method="POST">
@if (Session::has('success'))
<div class="alert alert-success">{{ Session::get('success') }}</div>
@endif
@if (Session::has('fail'))
<div class="alert alert-success">{{ Session::get('fail') }}</div>
@endif
@csrf
<h1 class="form-title">SIGN UP</h1>
<div class="field__container">
<div class="field field-name">
<input type="text" name="firstname" id="firstname" class="form-input input-firstname" placeholder="First Name" value="{{ old('firstname') }}" /><input type="text" name="lastname" id="lastname" class="form-input input-lastname" placeholder="Last Name" value="{{ old('lastname') }}" />
</div>
<div class="field">
<input type="email" name="email" id="email" class="form-input input-email" placeholder="Email" value="{{ old('email') }}"" />
</div>
<div class="field">
<input type="email" name="email_confirmation" id="email_confirmation" class="form-input input-email_confirmation" placeholder="Re-enter Email" />
</div>
<div class="field">
<input type="password" name="password" id="password" class="form-input input-password" placeholder="Password" />
</div>
<div class="field">
<input type="password" name="password_confirmation" id="password_confirmation" class="form-input input-password_confirmation" placeholder="Re-enter Password" />
</div>
</div>
<div class="button__container">
<button type="submit" name="btn_signup" class="btn-signup">Register</button>
<span>Already have an account? <a href="{{ route('auth.user.login') }}" class="btn-login">Login here.</a></span>
</div>
</form>
</div>
>Solution :
Your DB::Statement should have the following instead:
alter table `users` modify `id` int(10) unsigned zerofill not null auto_increment;
DO NOT drop the auto_increment flag. You are dropping it in your alter.
REMEMBER zerofill is a deprecated feature in mysql 8. It may be dropped on future version.