public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Overtime::create([]);
     }
 }
Ejemplo n.º 2
0
                 } elseif (0 === (int) $data["action"]) {
                     $totalOvertime = '';
                     if (!$hasNightDiff) {
                         $update = array('rest_day_overtime' => $totalOvertime);
                     } elseif ($hasNightDiff) {
                         $update = array('rest_day_overtime_night_diff' => $totalOvertime);
                     }
                     DB::table('employee_summary')->where('employee_id', $employeeId)->where('daydate', $employeeClocking->daydate)->update($update);
                 }
             }
         }
     }
     return Redirect::route('adminTimeClock');
 } else {
     foreach ($data["check"] as $check) {
         $overtimeById = Overtime::whereIn('id', $data["check"])->first();
         $employeeId = $overtimeById->employee_id;
         if ($overtimeById->seq_no === 1 || $overtimeById->seq_no === 2) {
             $shift = 1;
         } elseif ($overtimeById->seq_no === 3) {
             $shift = 2;
         }
         $timesheet = new Timesheet();
         $employeeClocking = Timesheet::where('id', $overtimeById->timesheet_id)->first();
         $schedule = new Schedule();
         //$getSchedule = $schedule->getSchedule($employeeId, $employeeClocking->daydate);
         $getSchedule = DB::table('employee_schedule')->where('employee_id', $employeeId)->where('schedule_date', trim($employeeClocking->daydate))->first();
         $Workshift = new Workshift();
         //$getWorkshiftByDayOfTheWeek = $Workshift->getWorkshiftByDayOfTheWeek($employeeId, date('l', strtotime($employeeClocking->daydate)), $overtime->shift);
         $getWorkshiftByDayOfTheWeek = DB::table('work_shift')->where('employee_id', $employeeId)->where('name_of_day', date('l', strtotime($employeeClocking->daydate)))->where('shift', $shift)->first();
         //return dd($getWorkshiftByDayOfTheWeek);
Ejemplo n.º 3
0
 /**
  * Remove the specified branch from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $overtime = Overtime::findOrFail($id);
     Overtime::destroy($id);
     Audit::logaudit('Overtimes', 'delete', 'deleted: ' . $overtime->type);
     return Redirect::route('overtimes.index')->withDeleteMessage('Employee Overtime successfully deleted!');
 }