laravel 调用未定义的方法Illuminate\Support\Fluent::after()

e4eetjau  于 2022-11-18  发布在  其他
关注(0)|答案(1)|浏览(124)

我一直试图运行php工匠迁移,但总是给这个错误
这是我的迁移:`

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterTableRhRacaCorAddCodEsocial extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('rh_raca_cor', function(Blueprint $table){
            $table->unsignedInteger('cod_esocial')->after('cod');
        });

        DB::statement("update rh_raca_cor set cod_esocial = case 
            when id = 1 then 4
            when id = 2 then 1
            when id = 3 then 5
            when id = 4 then 3
            when id = 5 then 2
            else 6 end;
        ");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('rh_raca_cor', function(Blueprint $table){
            $table->dropColumn('cod_esocial');
        });
    }
}

`
当我搜索时,一直试图找到这个相同的错误,但不幸的是无法解决它。

a11xaf1n

a11xaf1n1#

我所面临的问题与我安装的 composer 版本有关,它是最新的,但必须回到版本1.10.17

composer self-update 1.10.17;

相关问题