title: What is the difference between laravel cursor and laravel chunk method?
body: <p>I would like to know what is the difference between laravel chunk and laravel cursor method. Which method is more suitable to use? What will be the use cases for both of them? I know that you should use cursor to save memory but how it actually works in the backend? </p>
  
  <p>A detailed explanation with example would be useful because I have searched on stackoverflow and other sites but I didn't found much information.</p>
  
  <p>Here is the code snippet's from the laravel documentation.</p>
  
  <p><strong>Chunking Results</strong></p>
  
  <pre><code>Flight::chunk(200, function ($flights) {
      foreach ($flights as $flight) {
          //
      }
  });
  </code></pre>
  
  <p><strong>Using Cursors</strong></p>
  
  <pre><code>foreach (Flight::where('foo', 'bar')-&gt;cursor() as $flight) {
      //
  }
  </code></pre>