123456789101112131415161718192021 |
- <?php
-
- use Illuminate\Database\Seeder;
- use App\Professor;
- use App\Semester;
-
- class ProfessorSemesterSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- Professor::all()->each(function ($professor) {
- $semesters = Semester::inRandomOrder()->take(2)->get();
- $professor->semesters()->saveMany($semesters);
- });
- }
- }
|