title: How to concatenate columns with Laravel 4 Eloquent?
body: <p>I have a table called <code>tenantdetails</code> which contains</p>
  
  <pre><code>Tenant_Id | First_Name | Last_Name | ........
  </code></pre>
  
  <p>and I want to retrieve <code>First_Name</code> and <code>Last Name</code> as one column via the concatenation function of MySQL. So I write in my <code>controller</code> as follows</p>
  
  <pre><code>$tenants = Tenant::orderBy('First_Name')-&gt;lists('CONCAT(`First_Name`," ",`Last_Name`)','Tenant_Id');
  </code></pre>
  
  <p>But results the following error:</p>
  
  <blockquote>
  <pre><code> SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error 
   in your SQL syntax; check the manual that corresponds to your MySQL server
   version for the right syntax to use near '`," ",`First_Name`)`, 
   `Id` from `tenantdetails` order by `F' at line 1 
  
   (SQL: select `CONCAT(`First_Name`," ",`Last_Name`)`, `Id` 
   from `tenantdetails` order by `First_Name` asc).
  </code></pre>
  </blockquote>
  
  <p>How can we avoid the backticks while calling a function of MySQL in Laravel Eloquent. I am interested only in Eloquent (not in fluent query). Thanks in advance.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Thanks to @Andreyco for helping me. We can achieve this in a more elegant way using Laravel models, as below:<br></p>
  
  <p>In our <code>model</code>:</p>
  
  <pre><code>public function getTenantFullNameAttribute()
  {
      return $this-&gt;attributes['First_Name'] .' '. $this-&gt;attributes['Last_Name'];
  }
  </code></pre>
  
  <p>and in our <code>controller</code>:</p>
  
  <pre><code>$tenants = Tenant::orderBy('First_Name')-&gt;get();
  $tenants = $tenants-&gt;lists('TenantFullName', 'Tenant_Id');
  </code></pre>