skip to Main Content

Mysql – Passing laravel eloquent query params dynamically

I have the following query params in string format $query = '->whereIn('short_code', ["9999"])->whereBetween('request_timestamp', [request('startTime'), request('endTime')])'; How do i pass it to the eloquent? Am trying to achieve something like this InboundMessage::query()->{$query}; Am getting the error below Property [->whereIn('short_code', ["9999"])->whereBetween('request_timestamp', [request('startTime'),…

VIEW QUESTION

Mysql – How to get lastest created_at and updated_at

My code $datas = DB::table('patrol_gate_surveillance_transactions as a') ->leftJoin('client_locations as b','a.client_location_id', 'b.id') ->leftJoin('clients as c', 'b.client_id', 'c.id') ->select('a.client_location_id as location_id', 'b.name as location_name', 'c.name as client_name', DB::raw('SUM(CASE WHEN a.type = 1 THEN employee_qty ELSE 0 END) as e_qty_in'), DB::raw('SUM(CASE WHEN a.type…

VIEW QUESTION
Back To Top
Search