database/seeders/LessonHomeworkSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $lessons = CourseLesson::all();
        foreach ($lessons as $value) {
            $homeWorkCount = rand (1,3);
            LessonHomework::factory()->count($homeWorkCount)->create(['lesson_id'=>$value->id]);
        }
    }
public function run ( ) { $ lessons = CourseLesson :: all ( ) ; foreach ( $ lessons as $ value ) { $ homeWorkCount = rand ( 1 , 3 ) ; LessonHomework :: factory ( ) -> count ( $ homeWorkCount ) -> create ( [ 'lesson_id' => $ value -> id ] ) ; } }
Run the database seeds.
Run the database seeds .