I got it sorted. I had tunnel vision and was forgetting basic php and variable scope.
public function ShowCurrentRecentBreaks() {
$thestime = date("Y-m-d H:i:s");
$five = date("Y-m-d H:i:s",strtotime("-5 minutes",strtotime($thestime)));
$result = DB::table('breaks')
->join('users', function($join) use ($five){
$join->on('users.id', '=', 'breaks.user_id')
->where('breaks.break_end', '=', '0000-00-00 00:00:00')
->orWhere('breaks.break_end', '>=', $five);
})
->select('users.id', 'users.username', 'breaks.user_level', 'breaks.break_type', 'breaks.break_start', 'breaks.break_end')
->get();
return $result;
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community