/** * @Post("time/attendance/employee-records") * * @author Bertrand Kintanar */ public function show() { $work_date = Input::get('work_date'); $start_date = Carbon::parse($work_date); $end_date = Carbon::parse($work_date)->endOfMonth(); $period = new DatePeriod($start_date, new DateInterval('P1D'), $end_date); $month = []; foreach ($period as $row) { $attendance = Attendance::where('work_date', '>=', $row->toDateString())->where('work_date', '<=', $row->toDateString())->whereEmployeeId(Input::get('employee_id'))->first(); if ($attendance == null) { $month[$row->toDateString()] = null; continue; } $month[$row->toDateString()] = $attendance; } $this->data['employee_id'] = Input::get('employee_id'); $this->data['work_date'] = $work_date; $this->data['attendance'] = $month; $this->data['pageTitle'] = 'Employee Records'; return $this->template('pages.time.attendance.employee-records'); }