diff --git a/app/Http/Controllers/LogActivityController.php b/app/Http/Controllers/LogActivityController.php index 2e496f1..0a16149 100644 --- a/app/Http/Controllers/LogActivityController.php +++ b/app/Http/Controllers/LogActivityController.php @@ -24,18 +24,17 @@ class LogActivityController extends Controller $start = request('start_date'); $end = request('end_date'); $mapping = MappingUnitKerjaPegawai::where('statusenabled', true); - // dd(auth()->user()); - if(!Auth::guard('admin')){ + if(!Auth::guard('admin')->check()){ $mapping->where('objectpegawaifk', auth()->user()->dataUser->id); }else{ $mapping->where('objectpegawaifk', 937); } - $mapping->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']); + $mapping->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']); $unitIds = $mapping->pluck('objectunitkerjapegawaifk') - ->filter() // buang null - ->unique() - ->values() - ->all(); + ->filter() // buang null + ->unique() + ->values() + ->all(); $query = FileDirectory::withCount(['viewLogs as total_views' => function($q){ $q->select(DB::raw('COUNT(DISTINCT pegawai_id_entry)')); }])->withCount(['downloadLogs as total_download' => function($q){ @@ -43,9 +42,12 @@ class LogActivityController extends Controller }]) ->where('statusenabled', true) ->where('status_action', 'approved'); - if(in_array(22, $unitIds) || Auth::guard('admin') && Auth::guard('admin')->user()->id == 300){ + if ( + in_array(22, $unitIds) || + (Auth::guard('admin')->check() && Auth::guard('admin')->user()->id == 300) + ) { }else{ - $query = $baseQuery->whereIn('id_unit_kerja', $unitIds); + $query = $query->whereIn('id_unit_kerja', $unitIds); } $query = $query->orderBy('entry_at','desc'); diff --git a/resources/views/logActivity/index.blade.php b/resources/views/logActivity/index.blade.php index 0e4d151..e8f3316 100644 --- a/resources/views/logActivity/index.blade.php +++ b/resources/views/logActivity/index.blade.php @@ -139,7 +139,7 @@ document.addEventListener('DOMContentLoaded', () => { const paginationBtns = document.getElementById('logPaginationBtns'); const summaryText = document.getElementById('logSummaryText'); - if(tbody) tbody.innerHTML = '