title: Getting array keys instead of the value with Laravel
body: <p>I'm getting a problem while I want to loop through an array and display it with Laravel blade engine</p>
  <p><strong>My controllers code is like this</strong></p>
  <pre><code>    $table =  DB::table('tables')-&gt;select('id')-&gt;where('name', strtolower($name))-&gt;first();
  
      $columns =  Column::where('table_id', $table-&gt;id)-&gt;get();
  
      foreach ($columns as $col) {
          $data[] = $col-&gt;col_name;
      };
  
      $content = DB::table($name)-&gt;select(...$data)-&gt;get();
  
  
      return view('back.group.view-table', compact('content', 'columns', 'data'));
  </code></pre>
  <p><strong>And my blade view code is like this</strong></p>
  <pre><code>&lt;table class=&quot;table table-striped&quot;&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      @foreach($columns as $column)
                          &lt;th&gt;{{ $column-&gt;dis_name }}&lt;/th&gt;
                      @endforeach
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  @foreach ($content as  $value)
                      &lt;tr&gt;
                          
                          @for ($i = 0; $i &lt; count($columns); $i++)
                              &lt;td&gt;{{ $value-&gt;key = $data[$i] }}&lt;/td&gt;
                          @endfor
                          
                      &lt;/tr&gt;
                  @endforeach
                  
              &lt;/tbody&gt;
          &lt;/table&gt;
  </code></pre>
  <p>This is the result which I get with the following code:<br />
  <a href="https://i.stack.imgur.com/eXRNC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eXRNC.png" alt="This is the result which I get with the following code" /></a></p>
  <p>The result I want to have:<br />
  <a href="https://i.stack.imgur.com/PCywd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PCywd.png" alt="The result I want to have" /></a></p>