I have no problem in Laravel 5.2, but after creating a migration for the User model in Laravel 5.3, it shows the following error:
SQLSTATE[HY000]: General error: 1364 Field "family" has no default value
! ! !
In model users:
protected $fillable = [ 'name', 'email', 'password', 'family', 'mobile', 'address', 'status' ];
Migrating:
Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('family'); $table->string('mobile')->unique(); $table->string('address'); $table->boolean('status'); $table->string('email')->unique(); $table->string('password'); $table->integer('reagent'); $table->rememberToken(); $table->timestamps(); });
What is my problem?
You should add
->nullable()
or->default('somethingHere')
to fields that send null values.Or set the default value:
Than re-migration:
and