Skip to content

Commit 7b6d270

Browse files
committed
Refactor date comparisons to use where method for consistency and accuracy
1 parent 887ef42 commit 7b6d270

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/Helpers/Helper.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ public static function getUsersByPengelola($role, $tanggal)
747747
$usersIdByPengelola = Pengelola::cache()
748748
->get('all')
749749
->where('role', $role)
750-
->whereDate('active', '<', $tanggal)
750+
->where('active', '<', $tanggal)
751751
->reject(function ($item) use ($tanggal) {
752752
return $item['inactive'] && $item['inactive'] < $tanggal;
753753
})
@@ -758,7 +758,7 @@ public static function getUsersByPengelola($role, $tanggal)
758758
$usersIdByUnitKerja = DataPegawai::cache()
759759
->get('all')
760760
->where('unit_kerja_id', self::getPropertyFromCollection(self::getDataPegawaiByUserId(Auth::user()->id, $tanggal), 'unit_kerja_id'))
761-
->whereDate('tanggal', '<=', $tanggal)
761+
->where('tanggal', '<=', $tanggal)
762762
->pluck('user_id')
763763
->toArray();
764764
$koordinatorsId = array_intersect($usersIdByPengelola, $usersIdByUnitKerja);
@@ -807,7 +807,7 @@ public static function setDefaultPesertaRapat($tujuan, $tanggal)
807807
*/
808808
public static function getDataPegawaiByUserId($user_id, $tanggal)
809809
{
810-
return DataPegawai::cache()->get('all')->where('user_id', $user_id)->whereDate('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first();
810+
return DataPegawai::cache()->get('all')->where('user_id', $user_id)->where('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first();
811811
}
812812

813813
/**
@@ -1644,7 +1644,7 @@ public static function getTemplatePathById($id)
16441644
*/
16451645
public static function getLatestTataNaskahId($tanggal)
16461646
{
1647-
return self::getPropertyFromCollection(TataNaskah::cache()->get('all')->whereDate('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first(), 'id');
1647+
return self::getPropertyFromCollection(TataNaskah::cache()->get('all')->where('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first(), 'id');
16481648
}
16491649

16501650
/**
@@ -1666,7 +1666,7 @@ public static function getLatestHargaSatuanId($tanggal)
16661666
*/
16671667
public static function getLatestHargaSatuan($tanggal)
16681668
{
1669-
return HargaSatuan::cache()->get('all')->whereDate('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first();
1669+
return HargaSatuan::cache()->get('all')->where('tanggal', '<=', $tanggal)->sortByDesc('tanggal')->first();
16701670
}
16711671

16721672
/**

0 commit comments

Comments
 (0)