php - LARAVEL 8: Class 'DatabaseSeedersDB' not found

Solution:

That's because Laravel will look for DB class in the current namespace which is Database\Seeders.

Since Laravel has facades defined in config/app.php which allows you to use those classes without full class name.

    'DB' => Illuminate\Support\Facades\DB::class,

You can either declare DB class after the namespace declaration with

use DB;

or just use it with backslash.

    \DB::table('users')->insert([

Answer

Solution:

In the UserSeeder Class add:

use Illuminate\Support\Facades\DB;

Answer

Solution:

I have fixed same error in Laravel 9 by importing

use Illuminate\Database\Seeder;

Source