title: Change mysql content type before query laravel
body: <p>I have a problem, I had this table (Pkb) :
  <a href="https://i.stack.imgur.com/q9ohH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q9ohH.png" alt="enter image description here"></a></p>
  
  <p>It's basically a date (but in varchar format, YYYYMMDD), I want to select all the date before today using eloquent laravel 5  </p>
  
  <pre><code> $todays = Carbon::today();
   $filterdate = Pkb::whereDate('rtglb', '&lt;=', $today)-&gt;get();
  </code></pre>
  
  <p>It works on result if used in controller but not with php artisan tinker (so basically it's not working and thrown an error) :
  <a href="https://i.stack.imgur.com/Pe7tY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pe7tY.png" alt="enter image description here"></a></p>
  
  <p>When I put it in handle function in command console, It's not working too because it's rtglb are in varchar table. (I need to put it in command console to create scheduller)</p>
  
  <p>I have access to database, but I can't access the php code cause this table actually old module and I had to create new module that takes data from this table, calculate it using scheduller..</p>
  
  <p>is there anyway to convert the content of rtglb to date before select it? using eloquent or raw mysql? or are there any solution for me?</p>