|
17 | 17 | use App\Models\Template; |
18 | 18 | use App\Models\UnitKerja; |
19 | 19 | use App\Models\User; |
20 | | -use Illuminate\Database\Query\Builder; |
21 | 20 | use Illuminate\Support\Carbon; |
22 | 21 | use Illuminate\Support\Facades\Storage; |
23 | 22 | use Illuminate\Support\Str; |
@@ -390,16 +389,17 @@ public static function getUsersByPengelola($role, $tanggal, $unit_kerja_id = nul |
390 | 389 | ->where('active', '<=', $tanggal) |
391 | 390 | ->where(function ($query) use ($tanggal) { |
392 | 391 | return $query->where('inactive', '>', $tanggal) |
393 | | - ->orWhere('inactive', '=', null); |
| 392 | + ->orWhere('inactive', '=', null); |
394 | 393 | }) |
395 | 394 | ->pluck('user_id') |
396 | 395 | ->toArray(); |
397 | | - if ( $unit_kerja_id == null) { |
| 396 | + if ($unit_kerja_id == null) { |
398 | 397 | $usersId = $usersIdByPengelola; |
399 | 398 | } else { |
400 | 399 | $usersIdByUnitKerja = DataPegawai::cache()->get('all')->where('unit_kerja_id', $unit_kerja_id)->where('tanggal', '<=', $tanggal)->pluck('user_id')->toArray(); |
401 | 400 | $usersId = array_intersect($usersIdByPengelola, $usersIdByUnitKerja); |
402 | 401 | } |
| 402 | + |
403 | 403 | return User::cache()->get('all')->whereIn('id', $usersId); |
404 | 404 | } |
405 | 405 |
|
@@ -947,6 +947,6 @@ public static function setOptionTahun() |
947 | 947 |
|
948 | 948 | public static function setOptionPengelola($role, $tanggal, $unitKerjaId = null) |
949 | 949 | { |
950 | | - return self::setOptions(self::getUsersByPengelola($role, $tanggal, $unitKerjaId),'id','name'); |
| 950 | + return self::setOptions(self::getUsersByPengelola($role, $tanggal, $unitKerjaId), 'id', 'name'); |
951 | 951 | } |
952 | 952 | } |
0 commit comments