mercredi 2 mars 2022

Laravel 5.7 Chunk Exception: Cannot traverse an already closed generator

I am trying to get my models as generators so I can then loop over them 1 after the other, I am getting Exception: Cannot traverse an already closed generator.

 $chunk = MyModel::where('processed', '=', false)->cursor();
 foreach ($chunk as $c) {
  dd($c);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire