public function index()
 {
     $tglSekarang = time();
     $students = Student::get();
     foreach ($students as $student) {
         $dateDiff = $tglSekarang - $student['registered_at'];
         $durasi = floor($dateDiff / (60 * 60 * 24));
         $periode = Periode::first();
         if ($durasi > $periode['days']) {
             $student->update(['status' => 0]);
         } else {
             $student->update(['status' => 1]);
         }
     }
     return view('lms.index');
 }
 public function update($id, PeriodeRequest $request)
 {
     $periode = Periode::findOrFail($id);
     $input = $request->all();
     $periode->update($input);
     //process
     $tglSekarang = time();
     $students = Student::get();
     foreach ($students as $student) {
         $dateDiff = $tglSekarang - $student['registered_at'];
         $durasi = floor($dateDiff / (60 * 60 * 24));
         $periodes = Periode::first();
         if ($durasi > $periodes['days']) {
             $student->update(['status' => 0]);
         } else {
             $student->update(['status' => 1]);
         }
     }
     session()->flash('flash_message', 'You have been updated periode!');
     return redirect()->route('settings.periode');
 }