I have this DatabaseSeeder.php:
I ran into the similar error but I was using DB facade DB::table
rather than model. I am posting the answer just in case somebody has similar issues.
The seeder file had namespace namespace Database\Seeders;
and laravel was trying to look for DB class inside the namespace and hence the error appeared.
Class 'Database\Seeders\DB' not found
.
Resolutions:
composer dump-autoload
\DB::table('stock_categories')->([ ... ]);
so Laravel starts looking the DB facade from root (not from the namespace specified)Eg,
\DB::table('MemberInvitation')->insert( [
'id' => 'BlahBlah' ,//com_create_guid(),
'partner_id' => 1,
'fisrt_name' => 'Thats',
'last_name' => 'Me',
'email' => 'me@mymail.com',
'mobile_phone' => '444-342-4234',
'created_at' => new DateTime
] );