Answer the question
In order to leave comments, you need to log in
How to bind a user to specific tables in a database?
Here I am trying to bind a user to tables:
home and company
But I get an error
1364 Field 'avatar' doesn't have a default value
laravel 5.3
The code itself
Schema::create('house', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('description');
$table->string('country');
$table->string('region');
$table->string('street');
$table->string('nomer_doma');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
});
Answer the question
In order to leave comments, you need to log in
What exactly in the message " Field 'avatar' doesn't have a default value " do you not understand?
The avatar field (from some other table, most likely users ) must either be nullable or have a default value, or you must substitute a value when creating the entry.
https://laravel.com/docs/5.4/migrations#column-mod...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question