File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,7 @@ class SendReminder extends Command
2727 */
2828 public function handle ()
2929 {
30- $ tanggal = date ('Y-m-d ' );
31- $ reminders = DaftarReminder::with ('daftarKegiatan ' )
32- ->whereDate ('tanggal ' , $ tanggal )
33- ->whereTime ('waktu_kirim ' , '<= ' , date ('H:i:s ' ))
34- ->where ('status ' , '!= ' , 'sent ' )
35- ->get ();
30+ $ reminders = DaftarReminder::getRemindersForToday ();
3631 foreach ($ reminders as $ reminder ) {
3732 Helper::sendReminder ($ reminder );
3833 }
Original file line number Diff line number Diff line change @@ -32,4 +32,15 @@ protected static function booted(): void
3232 $ daftar ->status = 'on progress ' ;
3333 });
3434 }
35+
36+ public static function getRemindersForToday ()
37+ {
38+ $ tanggal = date ('Y-m-d ' );
39+
40+ return self ::with ('daftarKegiatan ' )
41+ ->whereDate ('tanggal ' , $ tanggal )
42+ ->whereTime ('waktu_kirim ' , '<= ' , date ('H:i:s ' ))
43+ ->where ('status ' , '!= ' , 'sent ' )
44+ ->get ();
45+ }
3546}
You can’t perform that action at this time.
0 commit comments