迁移文件后找不到Laravel类

时间:2015-10-04 16:14:10

标签: php laravel migration laravel-5.1

我正在使用Laravel Stapler进行图像处理,在迁移新表后,我尝试artisan migrate:refresh之后出现此错误:

  

[Symfony的\元器件\调试\异常\ FatalErrorException]    找不到“AddPhotoFieldsToStaffTable”类

但是,我可以在我的迁移文件夹中看到该文件并使用php artisan migrate,在尝试--refresh之前,它已成功迁移!

生成的文件是:

class AddPhotoFieldsToStaffTable extends Migration {

    /**
     * Make changes to the table.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('staff', function(Blueprint $table) {

            $table->string('photo_file_name')->nullable();
            $table->integer('photo_file_size')->nullable()->after('photo_file_name');
            $table->string('photo_content_type')->nullable()->after('photo_file_size');
            $table->timestamp('photo_updated_at')->nullable()->after('photo_content_type');

        });

    }

    /**
     * Revert the changes to the table.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('staff', function(Blueprint $table) {

            $table->dropColumn('photo_file_name');
            $table->dropColumn('photo_file_size');
            $table->dropColumn('photo_content_type');
            $table->dropColumn('photo_updated_at');

        });
    }

}

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:2)

使用composer dumpautoload解决了这个问题。

答案 1 :(得分:1)

只需执行命令

composer dump-autoload