title: How can I set the array key returned by Laravel's query builder?
body: <p>I have two tables, <code>page</code> and <code>edit</code>.</p>
  
  <p><code>page</code></p>
  
  <pre><code>+----+-----------+
  | id | page_name |
  +----+-----------+
  |  1 | page      |
  +----+-----------+
  </code></pre>
  
  <p><code>edit</code></p>
  
  <pre><code>+----+---------+------+
  | id | page_id | name |
  +----+---------+------+
  |  1 |       1 | home |
  |  1 |       1 | side |
  +----+---------+------+
  </code></pre>
  
  <p>Right now I have a relationship defined linking the two together. It returns something like this:</p>
  
  <pre><code>array(
    'id' =&gt; 1,
    'page_name' =&gt; 'page',
    'edit' =&gt; array(
      0 =&gt; array(
        'id' =&gt; 1,
        'page_id' =&gt; 1,
        'name' =&gt; 'home'
      ),
      1 =&gt; array(
        'id' =&gt; 2,
        'page_id' =&gt; 1,
        'name' =&gt; 'side'      
      )
    )
  )
  </code></pre>
  
  <p>I would like to be able to set the key of the <code>edit</code> array to the value of a certain column. Like so:</p>
  
  <pre><code>array(
    'id' =&gt; 1,
    'page_name' =&gt; 'page',
    'edit' =&gt; array(
      'home' =&gt; array( // the key is the name column
        'id' =&gt; 1,
        'page_id' =&gt; 1,
        'name' =&gt; 'home'
      ),
      'side' =&gt; array( // the key is the name column
        'id' =&gt; 2,
        'page_id' =&gt; 1,
        'name' =&gt; 'side'      
      )
    )
  )
  </code></pre>
  
  <p>How can I do this using Laravel's query builder? Or is this something I'll have to format &amp; structure manually with a loop?</p>