title: Laravel: Select raw query with filter doesnt return anything
body: <p>Previously I was able to display data normally, here it's still not there any filters, this is my code and the result.</p>
  <p>Code:</p>
  <pre><code>$app =  DB::select(DB::raw(&quot;
      select
          pel.id as id_pelamar,
          nm_pelamar as nama_pelamar,
          nm_rs as rumah_sakit,
          nm_unit as unit,
          nm_jabatan as jabatan,
          pel.tgl_lahir as tgl_lahir,
          his.status as status,
          pel.tanggal_ins as tanggal
      from (SELECT MAX(id) AS id_tr, id_pelamar FROM t_history_pelamar GROUP BY id_pelamar) x 
          inner join t_history_pelamar his on his.id=x.id_tr
          right join t_pelamar pel on pel.id=his.id_pelamar
          inner join m_rumah_sakit rs on rs.kd_rs=pel.kd_rs
          inner join m_unit u on u.kd_unit=pel.kd_unit 
          inner join m_jabatan j on j.kd_jabatan=pel.kd_jabatan 
      &quot;));
  </code></pre>
  <p>Result:
  <a href="https://i.stack.imgur.com/9GIdM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9GIdM.png" alt="result" /></a></p>
  <p>After I add the filter, no data is displayed.</p>
  <pre><code>$nm_rs = '';
  $from = '2020-04-01 00:00:00+07';
  $until = '2020-05-01 024:00:00+07';
  $name  = '';
  
  $app =  DB::select(DB::raw(&quot;
      select
          pel.id as id_pelamar,
          nm_pelamar as nama_pelamar,
          nm_rs as rumah_sakit,
          nm_unit as unit,
          nm_jabatan as jabatan,
          pel.tgl_lahir as tgl_lahir,
          his.status as status,
          pel.tanggal_ins as tanggal
      from (SELECT MAX(id) AS id_tr, id_pelamar FROM t_history_pelamar GROUP BY id_pelamar) x 
          inner join t_history_pelamar his on his.id=x.id_tr
          right join t_pelamar pel on pel.id=his.id_pelamar
          inner join m_rumah_sakit rs on rs.kd_rs=pel.kd_rs
          inner join m_unit u on u.kd_unit=pel.kd_unit 
          inner join m_jabatan j on j.kd_jabatan=pel.kd_jabatan 
      where
          (nm_rs = :nm_rs) AND 
          (pel.tanggal_ins BETWEEN :from AND :until) AND
          (nm_pelamar like :name)
      &quot;), [&quot;nm_rs&quot; =&gt; $nm_rs, &quot;from&quot; =&gt; $from, &quot;until&quot; =&gt; $until, &quot;name&quot; =&gt; &quot;%&quot;.$name.&quot;%&quot;]
      );
  return json_encode($app);
  </code></pre>
  <p>Thank you.</p>