Shift with red gradient lettering

Warning: Ambiguous class resolution.

Warning: Ambiguous class resolution, "MigrationFactorySeeder" was found in both "/laravel/app/database/migrations/MigrationFactorySeeder.php" and "/laravel/app/database/seeds/MigrationFactorySeeder.php", the first will be used.

Explanation

When folders use a classmap for autoloading it is possible for classes to conflict even though they may be stored in different folders. Prior to version 8, Laravel loaded the database/factories and database/seeds via a classmap. It also loads the database/migrations folder internally.

Solution

You must ensure any classes within folders autoloaded by a classmap have a distinct class name. Within Laravel, consider following the convention of suffixing the class name with a type (e.g. Factory or Seeder).

← Back to the knowledge base

Did this solve the error? Give us a shout out on Twitter. If not, email support for help.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.