Doctrine\DBAL\Schema\SchemaException: table 'users' 上没有名称为 'deleted_at' 的列

Doctrine\DBAL\Schema\SchemaException: There is no column with name 'deleted_at' on table 'users'

我构建了一个 API(背面:Laravel & 正面:angular),我想测试我的 API。 我是 Laravel 的初学者,当我想做一些集成测试时遇到了问题。确实,我尝试了这个小测试:

class userTest extends TestCase
{

    public function testExample()
    {
        $response = $this->getJson('/api/listUsers');
        $response->assertStatus(200);
    }

}

而且我总是遇到这个错误:

Doctrine\DBAL\Schema\SchemaException: There is no column with name 'deleted_at' on table 'users'.

虽然 'deleted_at' 存在于我的 table '用户中,所以我不明白,我在互联网上搜索但是当 运行 phpunit 命令时没有人得到这个错误。

class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('firstname');
            $table->string('lastname');
            $table->string('email')->unique();
            $table->string('password');
            $table->date('date_of_birth');
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down()
    {
        Schema::dropIfExists('users');

        Schema::table('users', function (Blueprint $table) {
            $table->dropSoftDeletes();
        });
    }
}

我的用户 class:

class User extends Authenticatable implements JWTSubject
{
    // 1. Dépendances
    use SoftDeletes;
    use Notifiable;


    // 2. properties

    protected $appends = ['fullname', 'age'];

    protected $fillable = [
        'firstname', 'lastname', 'email', 'password','date_of_birth'
    ];

    protected $hidden = [
        'password', 'remember_token', 'created_at', 'updated_at', 'deleted_at', 'pivot',
    ];
    protected $table = 'users';




    // 3. getters & setters
    public function setPasswordAttribute($password)
    {
        $this->attributes['password'] = bcrypt($password);
    }

    public function getFullNameAttribute() {
        return ucfirst($this->firstname) . ' ' . ucfirst($this->lastname);
    }

    public function getAgeAttribute()
    {
        return Carbon::parse($this->attributes['date_of_birth'])->age;
    }

    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    public function getJWTCustomClaims()
    {
        return [];
    }


    // 4. other methods
    public function projects()
    {
        return $this->belongsToMany(Project::class);
    }

}

请问有什么帮助吗??

尝试 运行 下面的命令。

php artisan cache:clear
php artisan config:clear
php artisan config:cache

此外,尝试从 $hidden 属性中删除 deleted_at 列。