title: Laravel - Select relation columns
body: <p>I am trying to write a query which selects columns from a model then selects one column from a relationship table.</p>
  <p><strong>Team Model</strong></p>
  <pre><code>   public function members(){
      return $this-&gt;hasManyThrough('App\User', 'App\Membership', 'team_id', 'id', 'id', 'user_id');
  }
  </code></pre>
  <p><strong>Member(user) model</strong></p>
  <pre><code>public function skills()
  {
     return $this-&gt;belongsToMany('App\Skill');
  }
  </code></pre>
  <p><strong>Function</strong></p>
  <p>Query i have attempted but had no luck:</p>
  <pre><code> $members = $this-&gt;team-&gt;members()
          -&gt;select('id', 'name')
          -&gt;with(['skills' =&gt; function ($query) {
            $query-&gt;select('name');
          }])
          -&gt;get();
  </code></pre>
  <p><strong>dump of query</strong></p>
  <p>When i dump the query it returns just the data for the <code>id</code> and <code>name</code> columns from the team table but the skills relation returns back empty when i want it to return the name from that table.</p>
  <pre><code>#relations: array:1 [▼
      &quot;skills&quot; =&gt; Illuminate\Database\Eloquent\Collection {#1657 ▼
        #items: []
      }
    ]
  </code></pre>
  <p>How would do i grab the <code>name</code> column from the <code>skills</code> relation table within this query?</p>