title: Laravel: InsertgetId and display results
body: <p>I would like to insert some records into my DB table and using the insertgetid feature, return those results to my blade view.</p>
  
  <p>Controller</p>
  
  <pre><code>    $grids[] = array();
  
      foreach($c as $key) {
  
      $grids[] = DB::table('infile')-&gt;insertGetId(
          array(  'href' =&gt; $key, 
                  'creator_id' =&gt; $id,
                  'random' =&gt; substr(str_shuffle("aBcEeFgHiJkLmNoPqRstUvWxYz0123456789"),0, 9))
      );
      }
  
      $name[] = array();
      foreach($grids as $id){
      $name = DB::table('infile')-&gt;where('id', '=', $id)-&gt;first();
      }
  
      return View::make('Home')-&gt;withName($name);
  </code></pre>
  
  <p>Blade View</p>
  
  <pre><code>@if(isset($name) &amp;&amp; $name != '')
                  {{dd($name)}}
                  @endif
  </code></pre>
  
  <p>I'm getting this error</p>
  
  <pre><code>ErrorException
  
  preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
  </code></pre>