When i type php artisan db:seed command. It’s showing this type of errors.
[ReflectionException]
Class UserTableSeeder does not exist
Here is my BlogsTableSeeder
<?php
use Illuminate\Database\Seeder;
class BlogsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Blog::class, 100)->create()->each(function ($blog){
$blog->save();
});
}
}
DatabaseSeeder.php
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
$this->call(RolesTableSeeder::class);
$this->call(BlogsTableSeeder::class);
}
}
Next let’s go to solve this problem Just run below command.
composer dump-autoload
Now DB seeding Successfully.