How to get all column with some having same name when using laravel eloquent?
<p>Let say I have 2 tables with column like this:</p>

<pre><code>table_a: (with a corresponding model TableA)
id | (20+ other field) | deleted_at | created_at | updated_at

table_b: (with a corresponding model TableB)
id | a_id | ( 30+ other field ) | deleted_at | created_at | updated_at
</code></pre>

<p>Now I am using laravel and join on this two table</p>

<pre><code>$result = TableA::join('table_b', 'table_a.id', '=', 'table_b.a_id')
    -&gt;where('table_b.created_at', '&gt;=', date('Y-m-d'))
    -&gt;get();
</code></pre>

<p>The problem is that I am not able to some field of table_b when the column name are the same as table_a. (i.e. <code>id</code>, <code>deleted_at</code>, <code>created_at</code> and <code>updated_at</code>)</p>

<p>I have done some search, and from <a href="https://stackoverflow.com/questions/33489406/laravel-5-1-handle-joins-with-same-column-names">this question on stackoverflow</a>, I may do:</p>

<pre><code>$result = TableA::join('table_b', 'table_a.id', '=', 'table_b.a_id')
    -&gt;where('table_b.created_at', '&gt;=', date('Y-m-d'))
    -&gt;select('table_b.id as b_id', 'table_b.created_at as b_created_at')
    -&gt;get();
</code></pre>

<p>However, when using this method, I need to add all the column name into the select statement, and it is painful to do that on 50+ fields. It is an exporting function so all fields are necessary. Is there a way I can make the necessary rename without listing all other field that don't need a rename to retrieve all the rows? Or is there a way I can retrieve all the row without a rename?</p>

<p>P.S. I am using laravel 4. This is an old project and updating is even more painful than listing all fields.</p>