skip to Main Content

Looping multyple DB connections in Laravel

I am summing the columns from different tables each in a different database. Created the models for each of the 8 connections and added them to the controller. use AppModelsobjectMapping1; use AppModelsobjectMapping2; use AppModelsobjectMapping3; use AppModelsobjectMapping4; use AppModelsobjectMapping5; use AppModelsobjectMapping6;…

VIEW QUESTION

how to get data from 19:00:00 pm to 07:00:00 am – Laravel

$star = $request->input('start_date'). ' ' . '19:00:00'; $end = $request->input('end_date'). ' ' . '07:00:00'; $employee_qty_in_shift2 = PatrolGateSurveillanceTransaction::where('type', 1) ->where('client_location_id', $request->client_location_id) ->where('created_at', '>=', $star) ->where('created_at', '<=', $end) ->sum('employee_qty'); dd($employee_qty_in_shift2); The above code cannot filter data from 19:00:00 to 07:00:00 Expected result:…

VIEW QUESTION

Laravel eloquent find in array of objects column

I have a table called services with multiple columns and one column named staff_assigned with this content: [{"user_id":"15549","price":"100"},{"user_id":"15548","price":"300"},{"user_id":"15552","price":"95"},{"user_id":"15553","price":"600"}] How can I find all services where user_id is 15548 with Laravel eloquent? Note that Service::where('staff_assign->user_id', "15548")->get(); doesn't work because column contains…

VIEW QUESTION
Back To Top
Search