title: Laravel 5.1: handle joins with same column names
body: <p>I'm trying to fetch following things from the database:</p>
  
  <ul>
  <li>user name</li>
  <li>user avatar_name</li>
  <li>user avatar_filetype</li>
  <li>complete conversation_messages</li>
  </ul>
  
  <p>with the following query:</p>
  
  <pre><code>    static public function getConversation($id)
  {
      $conversation = DB::table('conversation_messages')
          -&gt;where('belongsTo', $id)
          -&gt;join('users', 'conversation_messages.sender', '=', 'users.id')
          -&gt;join('user_avatars', 'conversation_messages.sender', '=', 'user_avatars.id')
          -&gt;select('users.name', 'conversation_messages.*', 'user_avatars.name', 'user_avatars.filetype')
          -&gt;get();
      return $conversation;
  }
  </code></pre>
  
  <p>It works fine so far, but the avatar's column name is '<code>name</code>' like the column name from the '<code>users</code>' table. 
  So if I'm using this query the to get the output via <code>$conversation-&gt;name</code>, the <code>avatar.name</code> overwrites the <code>users.name</code></p>
  
  <p>Is there a way to rename the query output like the mysql "as" feature at laravel 5.1?</p>
  
  <p>For example:</p>
  
  <pre><code>$conversation-&gt;avatarName
  
  $conversation-&gt;userName
  </code></pre>