private function empTlog($employeeid, $date, $i, $order) { return Timelog::employeeid($employeeid)->whereBetween('datetime', [$date->format('Y-m-d') . ' 06:00:00', $date->copy()->addDay()->format('Y-m-d') . ' 05:59:00'])->txncode($i)->orderBy('datetime', $order)->first(); }
/** * Get all the timelog for an employee on the day. * * @param Employee $employee, Carbon $date ('Y-m-d') * @return Collection of timelog */ public function employeeTimelogs(Employee $employee, $date) { $res = Timelog::employeeid($employee->id)->whereBetween('datetime', [$date->copy()->format('Y-m-d') . ' 06:00:00', $date->copy()->addDay()->format('Y-m-d') . ' 05:59:59'])->orderBy('datetime', 'ASC')->orderBy('txncode', 'ASC')->get(); return count($res) > 0 ? $res : false; }