title: how to chunk a join query in laravel
body: <p>Somewhere in my Laravel application, the following query is likely to return a very large results set:</p>
  
  <pre><code>$data = $query-&gt;join('accommodation_rooms', 'accommodations.id', '=', 'accommodation_rooms.accommodation_id')
      -&gt;join('discounts', 'accommodation_rooms.id', '=', 'discounts.accommodation_room_id')
      -&gt;select('accommodation_rooms.id')
      -&gt;orderBy('discounts.amount', 'desc')
      -&gt;select('discounts.amount', 'accommodations.*')
      -&gt;groupBy('discounts.amount', 'accommodation_rooms.id');
  return $data;
  </code></pre>
  
  <p>I wondered how I could load a part of the data faster but only load the rest later maybe using some pagination mechanism or something. </p>
  
  <p>Given the data is sent from an API, I want to know how I could chunk this data.<br>
  Thank you.</p>