title: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in order clause is ambiguous Laravel 5.5
body: <p>I just don't know what's wrong with my code and why it produces this error </p>
  
  <blockquote>
    <p>SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in order clause is ambiguous (SQL: select * from <code>processes</code> inner join <code>bags</code> on <code>processes</code>.<code>bag_id</code> = <code>bags</code>.<code>id</code> where <code>bags</code>.<code>type</code> = Recyclable and date(<code>processes</code>.<code>created_at</code>) = 2018-09-18 00:00:00 order by <code>created_at</code> desc limit 1) and here's my code </p>
  </blockquote>
  
  <pre><code>$bag = Bagcollect::join('bags', 'bagcollects.bag_id', '=', 'bags.id')
          -&gt;select('bags.type')
          -&gt;where('bagcollects.bag_id', $request-&gt;input('bag_id'))
          -&gt;first();
  
     //this query produce error
      $processexist = Process::join('bags', 'processes.bag_id', '=', 'bags.id')
          -&gt;where('bags.type', $bag-&gt;type)
          -&gt;whereDate('processes.created_at', Carbon::today())
          -&gt;latest()
          -&gt;first();
  </code></pre>