I have this code :
$employee_calendar->attendance = Attendance::leftJoin("attendance_corrections", function ($join) {
$join->on("attendance_corrections.attendance_id", "=", "attendance.id")
->where("attendance_corrections.status", "!=", "rejected");
})
->select('attendance.*', DB::raw('IF(`time` IS NOT NULL, `time`, attendance_corrections.correct_time) as `correctTime`'))
->where("attendance.employee_id", $employee->id)
->whereDate("attendance.date", "=", $employee_calendar->date)
->orderBy('correctTime', 'asc')
->with("requests")
->distinct()
->get();
I want to check if correctTime is null then dont show this data. I have tried ->whereNotNull('correctTime') it is giving error say column not found.