예제 #1
0
 /**
  * @Get("sandbox")
  * @author Bertrand Kintanar
  */
 public function sandbox()
 {
     // Show attendance of a given employee
     $employee = Employee::whereId(3)->first();
     $timelog = TimeLog::where('swipe_date', '>=', '2015-01-01')->where('swipe_date', '<=', '2015-01-31')->whereFaceId($employee->face_id)->get();
     dd($timelog);
     $this->data['pageTitle'] = 'Dashboard';
     return $this->template('pages.home');
 }
예제 #2
0
 /**
  * Execute the console command.
  *
  * @author Bertrand Kintanar
  */
 public function handle()
 {
     $csv = Reader::createFromPath(storage_path() . '/attendance.csv');
     $csv->setOffset(1);
     $data = $csv->query();
     foreach ($data as $lineIndex => $row) {
         $times = array_slice($row, 4, count($row) - 1);
         foreach ($times as $time) {
             if (empty($time)) {
                 continue;
             }
             $data = ['face_id' => $row[0], 'swipe_date' => $row[3], 'swipe_time' => $time, 'swipe_datetime' => Carbon::parse($row[3] . ' ' . $time)];
             $timelog = TimeLog::create($data);
             $this->info($timelog);
             Log::info($timelog);
         }
     }
 }