title: How to alias a left joined table in laravel eloquent
body: <p>Basically I have a situation where I made two left outer joins in my laravel query and now I want to select two columns and put one alias for them, if one column is null use the other columns value for that new aliased column. Something like NVL in SQL. Any suggestions?</p>
  
  <p>I tried something like ...->select('one or other as newName'); but it won't work.</p>
  
  <p>Edit: I have a table for articles that I join with user, news_groups and magazine_groups. Article that has news_group won't have magazine_group. I want to show those together in one joined column in select using alias.</p>
  
  <pre><code>DB::table('articles')
          -&gt;leftJoin('articles', 'articles.id', '=', 'articles.user_id')
          -&gt;leftJoin('news_groups', 'news_groups.id', '=', 'articles.news_group_id')
          -&gt;leftJoin('magazine_groups', 'magazine_groups.id', '=', 'articles.magazine_groups_id')
          -&gt;select('articles.id', 'type', 'title', 'articles.published_at',
              'users.first_name','users.last_name', 'news_groups.name or magazine_groups.name as group_name')
          -&gt;groupBy('articles.id');
  </code></pre>