I'm using mysql v5.7 and laravel v5.8. I made register function using by auth and when I try to register it's showing an error.
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value
(SQL: insert into users
(email
, password
, updated_at
, created_at
) values (***@gmail.com, $2yd4GvC, 2020-05-25 19:53:37, 2020-05-25 19:53:37))
it's working fine in localhost but showing this error after adding it to ec2 server.
I changed config/database.php
like this
'strict' => false,
then i can register, but there is no value in name columns.
and can put other columns except for name column.
I don't know why it's works on local server but showing error in live server.
This is my code.
User.php
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
create_users_table.php
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
Can anybody help me?