I have a custom query that grabs data from the old system and maps it to models in the new system. The query looks like this:
$companies = DB::connection('legacy')->select("...");
And since it's a lot of data, I'd like to use Eloquent's chunk feature (just sample code copied from their docs):
User::chunk(200, function($users)
{
foreach ($users as $user)
{
//
}
});
How do I implement this?