Exemple #1
0
 public static function getUser($competencyDateStart, $jabatan)
 {
     $user = RiwJabStruk::with('pegawai')->where('unit_staf_id', $jabatan)->where('tmt_mulai', '<=', $competencyDateStart)->where(function ($query) use($competencyDateStart) {
         $query->where('tmt_selesai', '>=', $competencyDateStart)->orWhere('tmt_selesai', '=', '0000-00-00');
     })->first();
     if ($user != null) {
         return $user;
     } else {
         return null;
     }
 }
 public static function getDetailbyDate($date, $nip)
 {
     $jabatan = RiwJabStruk::with('jabatan', 'pegawai', 'jabatan.unit')->where('nip', '=', $nip)->where('tmt_mulai', '<=', $date)->where(function ($query) use($date) {
         $query->where('tmt_selesai', '>=', $date)->orWhere('tmt_selesai', '=', '0000-00-00');
     })->orderBy('tmt_mulai', 'DESC')->first();
     if (count($jabatan) > 0) {
         return $jabatan;
     } else {
         return null;
     }
 }