Laravel php artisan db:seed leads to "use" statement error

In PHP the use statement is more of an alias than import. So since the ClassesTableSeeder class isn't in a defined namespace, you don't need to import the DB class. As a result you can remove use DB entirely.


In seeder class You don't need to use DB statement on top of the page. Any alias written inside config>app.php aliases array don't require use statement. This is because seeder doesn't have any namespace.


in laravel migration you dont need call DB ;

remove use DB;