Insert 1 million records using Laravel DB Seed
<p>I'm using faker to get dummy data and trying to add 1million records. Somehow I only can reach around 100000 rows only, Following is my code</p>

<pre><code>$no_of_rows = 1000000;

for( $i=1; $i &lt;= $no_of_rows; $i++ ){
        $user_data[] = [
            'status' =&gt; 'ACTIVE',
            'username' =&gt; $faker-&gt;userName,
            'email' =&gt; $faker-&gt;email,
            'password' =&gt; $password,
            'firstname' =&gt; $faker-&gt;firstName,
            'surname' =&gt; $faker-&gt;lastName,
            'mobilenumber' =&gt; $faker-&gt;phoneNumber,
            'confirmed' =&gt; (int)$faker-&gt;boolean(50),
            'gender' =&gt; $faker-&gt;boolean(50) ? 'MALE' : 'FEMALE',
            'dob' =&gt; $faker-&gt;date(),
            'address_line_1' =&gt; $faker-&gt;address,
            'address_line_2' =&gt; '',
            'post_code' =&gt; $faker-&gt;postcode,
        ];


}

User::insert($user_data);
</code></pre>

<p>I'm getting following error message</p>

<pre><code>PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted
</code></pre>

<p>I already set <code>ini_set('memory_limit', '1024M');</code></p>

<p>Any useful thoughts or solutions?</p>