title: Laravel DB Insert Error: Allowed Memory Size Exhausted
body: <p>I'm running into an issue when trying to insert ~20K records into my DB. I notice that even though I'm echoing inside my foreach loop, I'm not getting anything outputted in the command line. Instead, I get an error after inserting ~9440 records relating to...</p>
  
  <blockquote>
    <p><code>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
    to allocate 91 bytes) in
    /Users/me/Sites/Laravel/database/connection.php on line 293</code> </p>
  </blockquote>
  
  <p>Here is my code (tried using both Eloquent and Fluent):</p>
  
  <pre><code>&lt;?php
  
  class Process_Controller extends Base_Controller
  {
      public function action_migrate()
      {
          $properties = DB::table('raw_properties')-&gt;get('id');
          $total = count($properties);
  
          foreach ($properties as $x =&gt; $p) {
              $r = RawProperty::find($p-&gt;id);
              $count = $x + 1;
  
              $prop_details = array(
                  'column' =&gt; $r-&gt;field,
                  // Total of 21 fields
              );
  
              DB::table('properties')-&gt;insert($prop_details);
  
              echo "Created #$count of $total\n";
          }
      }
  }
  </code></pre>