Laravel class 迁移文件后未找到
Laravel class not found after migrating the file
我正在使用 Laravel Stapler 进行图像处理,在迁移新的 table 之后,我尝试 artisan migrate:refresh
然后显示此错误:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'AddPhotoFieldsToStaffTable' not found
但是,我可以在我的迁移文件夹中看到该文件并使用 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');
});
}
}
如有任何帮助,我们将不胜感激。
使用 composer dumpautoload
解决了这个问题。
只需执行命令
composer dump-autoload
我正在使用 Laravel Stapler 进行图像处理,在迁移新的 table 之后,我尝试 artisan migrate:refresh
然后显示此错误:
[Symfony\Component\Debug\Exception\FatalErrorException] Class 'AddPhotoFieldsToStaffTable' not found
但是,我可以在我的迁移文件夹中看到该文件并使用 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');
});
}
}
如有任何帮助,我们将不胜感激。
使用 composer dumpautoload
解决了这个问题。
只需执行命令
composer dump-autoload