BadMethodCallException ||方法 Illuminate\Database\Schema\Blueprint::after 不存在

BadMethodCallException || Method Illuminate\Database\Schema\Blueprint::after does not exist

BadMethodCallException ... 方法 Illuminate\Database\Schema\Blueprint::after 不存在。 我无法为我的项目迁移我的数据库...这是我遇到的错误

................................................ .........

cmd错误,(迁移失败):

E:\xampp\htdocs\face_clone1>php artisan migrate
Migrating: 2021_11_19_104856_update_users_table

   BadMethodCallException

  Method Illuminate\Database\Schema\Blueprint::after does not exist.

  at E:\xampp\htdocs\face_clone1\vendor\laravel\framework\src\Illuminate\Support\Traits\Macroable.php:103
     99|      */
    100|     public function __call($method, $parameters)
    101|     {
    102|         if (! static::hasMacro($method)) {
  > 103|             throw new BadMethodCallException(sprintf(
    104|                 'Method %s::%s does not exist.', static::class, $method
    105|             ));
    106|         }
    107|

  • Bad Method Call: Did you mean Illuminate\Database\Schema\Blueprint::date() ?

  1   E:\xampp\htdocs\face_clone1\database\migrations21_11_19_104856_update_users_table.php:23
      Illuminate\Database\Schema\Blueprint::__call("after")

  2   E:\xampp\htdocs\face_clone1\vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php:88
      UpdateUsersTable::{closure}(Object(Illuminate\Database\Schema\Blueprint))

E:\xampp\htdocs\face_clone1>

我的代码在这里:

    <?php
        
        use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
        
        class UpdateUsersTable extends Migration {
            /**
             * Run the migrations.
             *
             * @return void
             */
            public function up()
            {
                  Schema::table('users', function (Blueprint $table){
                    $table->after('name', function ($table){
                       $table->renameColumn('name', 'fname');
                       $table->string('lname');
                       $table->boolean('sex');
                       $table->date('b_day')->default('2021-01-01');
                       $table->string('image');
                    });
                });
            }
        
            /**
             * Reverse the migrations.
             *
             * @return void
             */
            public function down()
            {
                //
            } 
      }
    

已解决::: 谢谢 bhucho [https://whosebug.com/users/9471283/bhucho]

<?php
    
    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    class UpdateUsersTable extends Migration
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
              Schema::table('users', function (Blueprint $table){
                $table->renameColumn('name', 'fname');
                   $table->string('lname')->after('email');
                   $table->boolean('sex')->after('email');
                   $table->date('b_day')->default('2021-01-01')->after('email');
                   $table->string('image')->after('email');
            });
        }
    
        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            //
        }
    }