When I run php artisan migrate
to migrate my database
I get the following error:
In Migrator.php line 448:
Class 'AddNewStatusFlagsToUsersTable' not found
This is my code for my migration.
<?php
use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;
class AddNewStatusFlagsToUsersTable extends Migration
{
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('decline_plg')->default(false);
$table->boolean('unresponsive')->default(false);
$table->boolean('filing_directly_to_amazon')->default(false);
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('decline_plg');
$table->dropColumn('unresponsive');
$table->dropColumn('filing_directly_to_amazon');
});
}
}
Filename 2022_10_05_184432_add_new_status_flags_to_users_table.php
I’ve run this commands:
php artisan clear-compiled
php artisan optimize:clear
composer dump-autoload
php artisan optimize
But still nothing works.
How to solve this laravel migration?
2
Answers
I can’t see any obvious issues.
Try running
composer update
change
class AddNewStatusFlagsToUsersTable extend Migration
toreturn new class extends migration
to use Anonymous Migrations: