数据库没有在laravel中插入值?

Below is a piece of code from my Register Controller. As you can see, every field has a value, but its not inserting into database. I have configured default values to these fields in database, if values are not present. It gives row don't have default value. I am unable to figure out the problem. I also have all fields fillable in Models.

protected function create(array $data)
{
  $user = Account::create([
    'wallet' => $data['wallet'],
    'email' => $data['email'],
    'balance' => 0,
    'uqid' => rand(10000000,99999999) ,
    'ref' => 0,

  ]);
$gnl = General::first();
$track = Track::create([
    'account_id' => $user->id,
    'speed' => $gnl->dhs_free,
    'balance' => 0,
    'uqid' => rand(10000000,99999999) ,
    'ref' => 0,

  ]);

Account Model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Account extends Model
{
    protected $fillable = ['wallet','uqid','ref','bstatus','refcom','email','verified'];

   public function deposit()
   {
       return $this->hasMany('App\Deposit','id','account_id');
   }
   public function withdraw()
   {
       return $this->hasMany('App\Withdraw','id','account_id');
   }
   public function track()
   {
       return $this->hasMany('App\Track','id','account_id');
   }

Track Model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Track extends Model
{
    protected $fillable = array( 'account_id','speed','withdraw','status');

    public function account()
    {
        return $this->belongsTo('App\Account');
    }
}

When using the create function, it seems you are not filling all the fields in the table.

Either, ensure you're assigning values to all fields in the create() function, or ensure there are default values in the database. In the builder, use ->default(0) or something.

There are few things which can be identified in your code :

Firstly the number and name of the columns in the Model and create method are different :

Account Model contains :

protected $fillable = ['wallet','uqid','ref','bstatus','refcom','email','verified'];

But your create contains :

'wallet' => $data['wallet'],
'email' => $data['email'],
'balance' => 0,
'uqid' => rand(10000000,99999999) ,
'ref' => 0,

Create does not contain bstatus, refcom and so on... columns but those are present in your Model and in the database table.

Similarly, Track Model contains :

 protected $fillable = ['account_id','speed','withdraw','status'];

But its create contains :

'account_id' => $user->id,
'speed' => $gnl->dhs_free,
'balance' => 0,
'uqid' => rand(10000000,99999999) ,
'ref' => 0,

Now, if your non-specified columns in create() function do not have any default value specified in database, you will get :

Error : row don't have default value

Solution either add values to those columns in create() or mark those columns are nullable using a migration.