When I run php artisan db:seed I am getting the following error:
[ReflectionException] Class SongsTableSeeder does not exist
What is going on?
My DatabaseSeeder class:
<?php
use IlluminateDatabaseSeeder;
use IlluminateDatabaseEloquentModel;
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call('SongsTableSeeder');
}
}
My SongsTableSeeder class:
<?php
// Composer: "fzaninotto/faker": "v1.4.0"
use FakerFactory as Faker;
use IlluminateDatabaseSeeder;
use DB;
class SongsTableSeeder extends Seeder {
public function run()
{
$faker = Faker::create();
$songs = [];
foreach(range(1, 10) as $index)
{
$songs[] = ['title' => $faker->words(rand(1,4))];
}
DB::table('songs')->insert($songs);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…