@@ -59,11 +59,6 @@ class Helper
5959 '12 ' => 'Desember ' ,
6060 ];
6161
62- /**
63- * Role admin|kpa|kepala|ppk|bendahara|ppspm|koordinator|anggota|pbj|bmn.
64- *
65- * @var array
66- */
6762 public static $ role = [
6863 'kepala ' => 'Kepala ' ,
6964 'ppk ' => 'Pejabat Pembuat Komitmen ' ,
@@ -315,7 +310,7 @@ public static function nomor($tanggal, $jenis_naskah_id, $unit_kerja_id, $kode_a
315310 */
316311 public static function getPengelola ($ role )
317312 {
318- $ pengelola_id = Pengelola::cache ()->get ('all ' )->where ('role ' , $ role )->first ()->user_id ;
313+ $ pengelola_id = Pengelola::cache ()->get ('all ' )->where ('role ' , $ role )->first ()->user_id ?? '' ;
319314
320315 return User::cache ()->get ('all ' )->where ('id ' , $ pengelola_id )->first ();
321316 }
@@ -577,7 +572,7 @@ public static function getDetailAnggaran($mak, $level = 'akun', bool $kode_prefi
577572 ];
578573 $ detail = KamusAnggaran::cache ()->get ('all ' )->filter (function ($ item , $ key ) use ($ mak , $ length , $ level ) {
579574 return Str::of ($ item ->mak )->startsWith (Str::substr ($ mak , 0 , $ length [$ level ])) && Str::of ($ item ->mak )->length == $ length [$ level ];
580- })->first ()->detail ;
575+ })->first ()->detail ?? '' ;
581576
582577 return $ kode_prefix ? $ kode [$ level ].$ detail : $ detail ;
583578 }
@@ -593,7 +588,7 @@ public static function getJenisKontrak($tahun, $bulan): array
593588 {
594589 $ tanggal = Carbon::createFromDate ($ tahun , $ bulan )->startOfMonth ();
595590
596- return JenisKontrak::cache ()->get ('all ' )->where ('tanggal ' , '<= ' , $ tanggal )->sortByDesc ('tanggal ' )->first ()->jenis ;
591+ return JenisKontrak::cache ()->get ('all ' )->where ('tanggal ' , '<= ' , $ tanggal )->sortByDesc ('tanggal ' )->first ()->jenis ?? '' ;
597592 }
598593
599594 /**
@@ -799,7 +794,7 @@ public static function formatSpj($spesifikasi)
799794 */
800795 public static function getTemplatePath ($ jenis )
801796 {
802- $ file = Template::cache ()->get ('all ' )->where ('slug ' , 'template_ ' .$ jenis )->first ()->file ;
797+ $ file = Template::cache ()->get ('all ' )->where ('slug ' , 'template_ ' .$ jenis )->first ()->file ?? '' ;
803798
804799 return Storage::disk ('templates ' )->path ($ file );
805800 }
@@ -828,7 +823,7 @@ public static function hapusTitikAkhirKalimat($kalimat)
828823
829824 public static function setOptionsMataAnggaran ($ tahun )
830825 {
831- $ dipa_id = Dipa::cache ()->get ('all ' )->where ('tahun ' , $ tahun )->first ()->id ;
826+ $ dipa_id = Dipa::cache ()->get ('all ' )->where ('tahun ' , $ tahun )->first ()->id ?? '' ;
832827
833828 return self ::setOptions (MataAnggaran::cache ()->get ('all ' )->where ('dipa_id ' , $ dipa_id ), 'mak ' , 'mak ' );
834829 }
0 commit comments