I'm having this error in my query, I've already identified that the use of whereBetween
within a function
join
is impossible to use, but I saw that staff could use DB::Raw
and replace that whereBetween
%.
The point is that I did not find any examples of using DB::Raw
within function
join
and the forms I tried were not successful.
Code:
$exec = DB::table('execucao_acompanhamento as a')
->join('execucao_acompanhamento_busca_bens as h', function($join)
use($data_busca_1_1, $data_busca_1_2){
$join->on('a.id','=','h.acompanhamento_id')
->where('h.busca_bens_id','=','1')
->whereBetween('h.data_busca', ["$data_busca_1_1","$data_busca_1_2"]);
})
->get();