-3

I got an error message:

SQLSTATE[HY000]: General error: 1364 Field 'place_of_birthday' doesn't have a default value SQL: insert into users (full_name, email, password, updated_at, created_at) values (Evan Agustian Lukius, evan.agustian.148@gmail.com, $2y$10$uAK3YAhu8YxAvuRRuo.Ml.wQ2rYXXT7FylcNwLFjOk1lYPS3AICoa

Here is my error message screenshot:

photo

How to solve this error?

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
  • 4
    you are not passing value for place_of_birthday filed and in database it has not default value means null or anything else – Karan Dec 02 '19 at 04:28

2 Answers2

1

if you are not passing any value in your non-nullable column it will give you this error everytime so make the column nullable. Change in your migration file:

like this:

$table->string('place_of_birthday')->nullable(); //assuming you have string column. no matter what type of column u have just use ->nullable()

fahim152
  • 2,531
  • 1
  • 10
  • 29
0

In your migration you can do this to make the column nullable:

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->string('place_of_birthday')->nullable();
    });
}

->nullable() Designate that the column allows NULL values

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64