private function updateUsersTable()
    {
        Schema::table('users', function ($table) {
            foreach ($this->fields as $field => $value) {
                if (!Schema::hasColumn('users', $field)) {
                    $type  = $value['type'];
                    $query = $table->$type($field);

                    if (isset($value['extra'])) {
                        $extra = $value['extra'];
                        $query->$extra();
                    }

                    if ($field == 'role_id') {
                        $table->foreign('role_id')->references('id')->on('roles');
                    }
                }
            }

            if (!Schema::hasColumn('users', 'created_at') && !Schema::hasColumn('users', 'updated_at')) {
                $table->timestamps();
            }

            if (!Schema::hasColumn('users', 'deleted_at')) {
                $table->softDeletes();
            }
        });
    }
private function updateUsersTable()
    {
        Schema::table('users', function ($table) {
            foreach ($this->fields as $field => $value) {
                if (!Schema::hasColumn('users', $field)) {
                    $type  = $value['type'];
                    $query = $table->$type($field);

                    if (isset($value['extra'])) {
                        $extra = $value['extra'];
                        $query->$extra();
                    }

                    if ($field == 'role_id') {
                        $table->foreign('role_id')->references('id')->on('roles');
                    }
                }
            }

            if (!Schema::hasColumn('users', 'created_at') && !Schema::hasColumn('users', 'updated_at')) {
                $table->timestamps();
            }

            if (!Schema::hasColumn('users', 'deleted_at')) {
                $table->softDeletes();
            }
        });
    }
private function updateUsersTable ( ) { Schema :: table ( 'users' , function ( $ table ) { foreach ( $ this -> fields as $ field => $ value ) { if ( ! Schema :: hasColumn ( 'users' , $ field ) ) { $ type = $ value [ 'type' ] ; $ query = $ table -> $ type ( $ field ) ; if ( isset ( $ value [ 'extra' ] ) ) { $ extra = $ value [ 'extra' ] ; $ query -> $ extra ( ) ; } if ( $ field == 'role_id' ) { $ table -> foreign ( 'role_id' ) -> references ( 'id' ) -> on ( 'roles' ) ; } } } if ( ! Schema :: hasColumn ( 'users' , 'created_at' ) && ! Schema :: hasColumn ( 'users' , 'updated_at' ) ) { $ table -> timestamps ( ) ; } if ( ! Schema :: hasColumn ( 'users' , 'deleted_at' ) ) { $ table -> softDeletes ( ) ; } } ) ; }
Add the not existing columns
to the existing users table
Add the not existing columns to the existing users table