I developed following code,
public function getInCalls($sip_id){
$resultsTotalInCalls = DB::table('xxxx')
->whereDate('created', '=', date('Y-m-d'))
->where(function ($query) {
$query->where([
['event', '=', 'ENTERQUEUE'],
['agent', '=', $sip_id]
]);
})
->get();
$numberofInCalls = count($resultsTotalInCalls);
return $numberofInCalls;
}
But I got undefined index $sip_id in ['agent', '=', $sip_id]
line. How to pass $sip_id in to function? I have no idea.