title: Is it possible to create dynamic migrations in laravel 5
body: <p>wondering if it is possible to run a foreach loop inside a Laravel migration file.</p>
  
  <p>for instance:</p>
  
  <pre><code>public function up()
  {
  
      Schema::create('tests', function (Blueprint $table) {
  
  
          $testarray = [
              'string' =&gt; 'name',
              'string' =&gt; 'lastname',
              'string' =&gt; 'random',
          ];
  
  
          $table-&gt;increments('id');
  
          foreach ($testarray as $type =&gt; $column)
          {
              $table-&gt;$type($column);
          }
  
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>unfortunately, the above will migrate; however, only the last item in the array will get created. </p>
  
  <p>I have tried this a few different ways to no avail. </p>
  
  <p>But....considering that, at least, some data makes it through and the migration actually runs, there should be a way to make this work. </p>
  
  <p>I feel as though I must be missing something obvious to get this working.</p>