database/seeders/CourseLessonSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $courses = Course::all();
        foreach ($courses as $value) {
            $lessonCount = rand (7,23);
            CourseLesson::factory()->count($lessonCount)->create(['course_id'=>$value->id]);
        }
    }
public function run ( ) { $ courses = Course :: all ( ) ; foreach ( $ courses as $ value ) { $ lessonCount = rand ( 7 , 23 ) ; CourseLesson :: factory ( ) -> count ( $ lessonCount ) -> create ( [ 'course_id' => $ value -> id ] ) ; } }
Run the database seeds.
Run the database seeds .