Support the ongoing development of Laravel.io →
posted 4 years ago

why can Not seed users table???

`> >

vagrant@homestead:~/MyApp$ php artisan db:seed --class=UserSeeder

Illuminate\Contracts\Container\BindingResolutionException

Target class [UserSeeder] 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

  +24 vendor frames

25 artisan:37 Illuminate\Foundation\Console\Kernel::handle() vagrant@homestead:~/MyApp$

class UserSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run() { DB::table('users')->insert([ 'name' => Str::random(10), 'email' => Str::random(10).'@gmail.com', 'password' => Hash::make('password'), ]); //$this->call(UserSeeder::class); } }`

Last updated 3 years ago.
0

try > composer dumpautoload

Last updated 4 years ago.
0
Solution

composer dump-autoload after seed worked

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.