I have the working working in postgres
select * from "prospects_audit_dump" where date_created::date between ['2021-03-01' and '2021-03-15'] and ( ("parent_id" in ('4747f33c-764c-11eb-b43f-0265ed7510c2', '771782c0-8197-11eb-8d62-020683bef092', '8c400d42-2470-11e9-917b-066c2def7d44') and "after_value_string" = 'MGL' and "before_value_string" != 'Open_inbound') or ("before_value_string" = 'Open_inbound' and "after_value_string" = 'MGL') or ("before_value_string" = 'MGL' and "after_value_string" = 'MQL'));
I have tried to convert this as laravel query
$audit_table_result=DB::table($type.'_audit_dump')->whereBetween(DB::raw('date_created::date'),['2021-03-01','2021-03-15');
$audit_table_result=$audit_table_result->where(function ($query) use ($meeting_ids) {
return $query->whereIn('parent_id', $meeting_ids)->where('after_value_string', 'MGL')->where('before_value_string', '!=', 'Open_inbound');
}) ->orWhere(function ($query) {
return $query->where('before_value_strings', 'Open_inbound')->where('after_value_string', 'MGL');
})
->orWhere(function ($query) {
return $query->where('before_value_string', 'MGL')->where('after_value_string', 'MQL');
});
$audit_table_result=$audit_table_result->get();
but missing the outter bracket after between '2021-03-01' and '2021-03-15' and
select * from "prospects_audit_dump" where date_created::date between '2021-03-01' and '2021-03-15' and ( ); how to alter my laravel query.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire