Level 75
See if chunk will help you, it's in the documentation.
I need some pagination help … I have a table of 12,000+ records and without pagination, it is killing RAM. BUT I have to pass each through a transformer to process before loading and when I do the following I lose the $masters->link().
public function master_control()
{
$masters = [];
$parts = EcoComponentMaster::where('description', '!=', 'DISCARDED')
->orderBy('model_value', 'desc')
->paginate(100);
foreach($parts as $master) {
$master = (new EcoComponentMastersTransformer)->transform($master);
$masters[] = $master;
} // end foreach
// return $masters;
return view('aeroeco.master_control', compact('masters'));
} // end function
Please or to participate in this conversation.