I have used only SINGLE FILE with TWO classes in it following :
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\Lesson;
use Faker\Factory as Faker;
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//Lesson::truncate();
Model::unguard();
$this->call("LessonsTableSeeder");
}
}
class LessonsTableSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
foreach(range(1,30) as $index) {
Lesson::create(['title' => $faker->sentence(5), 'body' => $faker->paragraph(4)]);
}
}
}