Can we see your migration file with the table structure ?
I would think the id is not set as auto increment but I cant confirm without seeing the database table structure
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, everyone
Can someone please help me fix this error: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint DETAIL:
I have deployed my code to Heroku and created a new database, locally I was using MySQL. When i run the app the home page works but when i register I get the error.
Here is my Register Controller Code :
/** * Create a new user instance after a valid registration. * * @param array $data * @return \App\User */
protected function create(array $data)
{
$settings = Settings::first();
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'usertype' => $data['usertype'],
'password' => Hash::make($data['password']),
'active'=>0,
'token'=> Str::uuid(40),
'bonus' => Carbon::now(),
'main_balance'=>$settings->signup_bonus,
]);
Reflink::create([
'user_id'=> $user->id,
'link'=> $data['email'],
]);
$user->sendVerificationEmail();
event(new UserReferred(request()->cookie('ref'), $user));
session()->flash('message', 'Dear user your account has been successfully created but not active. To active your account please check your email for verify code.');
Session::flash('type','success');
Session::Flash('title','Account Created Successfully, Check Verification Email');
Session::flash('icon','success');
return $user;
}
Please or to participate in this conversation.