I have an app with laravel 7, and i upgrade composer 1.10 to composer 2.0, and i have this problem:
Illuminate\Contracts\Container\BindingResolutionException
Target class [DatabaseSeeder] does not exist.
at vendor/laravel/framework/src/Illuminate/Container/Container.php:807
803|
804| try {
805| $reflector = new ReflectionClass($concrete);
806| } catch (ReflectionException $e) {
> 807| throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
808| }
809|
810| // If the type is not instantiable, the developer is attempting to resolve
811| // an abstract type such as an Interface or Abstract Class and there is
+37 vendor frames
38 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
I tried many solution (even for Laravel 8 ...) without success.
Here is the autoload of the composer.json
"psr-4": {
"App\\": "app/",
"DatabaseSeeder\\": "database/seeds"
},
"files": [
"app/helpers.php"
]
}
Thx !
EDIT
Here is what I just found: When I add in the composer.json :
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories",
"Database\\Seeds\\": "database/seeds",
"DatabaseSeeder\\": "database/seeds/",
} },
and that I modify line 84 of SeedCommand.php 'src/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php', it work !!!
$class = $this->laravel->make($this->input->getOption('class'));
by
$class = $this->laravel->make('Database\\Seeds\\DatabaseSeeder');
But this is absolutely not maintainable... So the problem is, there is a problem when DatabaseSeeder is set.
6An idea ?