title: Laravel Chunk Method Using Eloquent
body: <p>For processing large database, laravel provides chunk method as here <a href="https://laravel.com/docs/5.1/queries#retrieving-results" rel="noreferrer">https://laravel.com/docs/5.1/queries#retrieving-results</a> </p>
  
  <p>But how can I use chunk method in this query,</p>
  
  <pre><code> $data = Inspector::latest('id')
                  -&gt;select('id', 'firstname', 'status', 'state', 'phone')
                  -&gt;where('firstname', 'LIKE', '%' . $searchtext . '%')
                  -&gt;get();
  </code></pre>
  
  <p>where I'm returning json response like this,</p>
  
  <pre><code>echo json_encode($data);
  </code></pre>
  
  <p>Any suggestions....</p>