user860511
user860511

Reputation:

Laravel class not found after migrating the file

I am using Laravel Stapler for image purposes and after migrating the new table, I attempt to artisan migrate:refresh afterwards and I am shown this error:

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'AddPhotoFieldsToStaffTable' not found

However, I can see the file within my migration's folder and using php artisan migrate, before trying to --refresh it, it successfully migrated!

The file that was generated is:

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');

        });
    }

}

Any help would be greatly appreciated.

Upvotes: 3

Views: 112

Answers (2)

Almazik G
Almazik G

Reputation: 1077

Just do the command

composer dump-autoload

Upvotes: 1

user860511
user860511

Reputation:

Using composer dumpautoload solved this issue.

Upvotes: 2

Related Questions