title: How to alias the name of a column in Eloquent
body: <p>I have an eloquent model named Eloquent:</p>
  
  <pre><code>Products::where("actice", "=", true)-&gt;get()-&gt;toArray();
  </code></pre>
  
  <p>Now I want to add join-statement to it, I have defined a scopeQuery with:</p>
  
  <pre><code>public function scopeJoinWithTags($query)
      {
          return $query-&gt;leftJoin("tags", "tags.id", "=", "products.tag_id");
      }
  </code></pre>
  
  <p>Then our main query changes to:</p>
  
  <pre><code>Products::where("actice", "=", true)-&gt;joinWithTags-&gt;get()-&gt;toArray();
  </code></pre>
  
  <p>What I get is OK, it is what I do expect, but I want to change the name property of tags table to tag_name, how should I do that? I mean, i say somewhere in my query to:</p>
  
  <pre><code> tags.name AS tag_name
  </code></pre>
  
  <p>So that in the final result array I do :</p>
  
  <pre><code>$result[$i]['tag_name'];
  </code></pre>
  
  <p>While now I have to :</p>
  
  <pre><code>$result[$i]['name'];
  </code></pre>