public function run() { App\Fase::all()->each(function ($fase) { $fase->tareas()->attach(App\Tarea::find(rand(1, 50))); $fase->save(); }); }
/** * Run the database seeds. * * @return void */ public function run() { factory(App\Actividad::class, 50)->make()->each(function ($actividad) { $actividad->tarea()->associate(App\Tarea::find(rand(1, 50))); $actividad->save(); }); }
public function run() { App\Rol::all()->each(function ($rol) { $rol->tareas()->attach(App\Tarea::find(rand(1, 50))); $rol->save(); }); }