Problem: Laravel App. Getting this after I tried to create a user in my database:
SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: users.password (SQL: insert into "users" ("name", "email", "updated_at", "created_at") values (cooldude, [email protected], 2021-02-10 03:27:58, 2021-02-10 03:27:58))
The following is how my route looked in my api.php file:
Route::get('/user-create',function (Request $request) {
App\Models\User::create([
'name' => 'cooldude',
'email' => '[email protected]',
'passsword' => Hash::make('password')
]);
});
Do you see the problem in my code?? Well, looke at the 'passsword' it should be 'passsword'
Summary: If you are getting a similar error in your laravel project, it means that the password field or any other required field cannot be blank or NULL, so you either mispelled the column name or you are missing a required field.