title: Laravel Query builder: left join, select, and where not working
body: <p>Unfortunately the Laravel query builder seems not in a good mood!</p>
  
  <p>Here is my table structure: </p>
  
  <p>Table <code>user</code> structure</p>
  
  <pre><code>ID, USERNAME, NAME, USER_ROLE_MODULE_ID
  </code></pre>
  
  <p>Table <code>user_role_module</code> structure</p>
  
  <pre><code>ID, NAME 
  </code></pre>
  
  <p>And this is my query builder statement</p>
  
  <pre><code>DB::table('user')
  -&gt;leftJoin('user_role_module', 'user.user_role_module_id', '=', 'user_role_module.id')
  -&gt;select('user.*', 'user_role_module.name as user_role')
  -&gt;where("name LIKE '%Jhon%' ") "or other example" -&gt;where("user_role LIKE '%admin%' ")
  -&gt;paginate(10);
  </code></pre>
  
  <p><strong>Goal:</strong></p>
  
  <p>I just want to get all data from <code>user</code> + user role name from <code>user_role_module</code> AND also applies in WHERE statement so I can use it for search feature.</p>
  
  <p>I am getting result from WHERE statement without specifying table name. because it already stated which table and column to select from SELECT statement.</p>
  
  <p><strong>The problem:</strong> </p>
  
  <ol>
  <li><p>if I search for name, it return error ambiguous column //Laravel is confusing whether taking <code>name</code> from user table or user_role_module table!</p></li>
  <li><p>if I search for user_role, then the column doesn't exist</p></li>
  </ol>
  
  <p>Why is it? What is the solution? </p>