Skip to content

Commit 93a0016

Browse files
committed
Add withCount for daftarSp2d in indexQuery method for improved query results
1 parent 6c66d1a commit 93a0016

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/Nova/KerangkaAcuan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public static function label()
4242

4343
public static function indexQuery(NovaRequest $request, $query)
4444
{
45-
$query->whereYear('tanggal', session('year'));
45+
$query->whereYear('tanggal', session('year'))->withCount('daftarSp2d');
4646
if (Policy::make()->allowedFor('ppk,arsiparis,bendahara,kpa,ppspm')->get()) {
4747
return $query;
4848
} elseif (Policy::make()->allowedFor('koordinator,anggota')->get()) {
4949
return $query->where('unit_kerja_id', Helper::getDataPegawaiByUserId($request->user()->id, now())->unit_kerja_id);
5050
}
5151

52-
return $query->withCount('daftarSp2d');
52+
return $query;
5353
}
5454

5555
/**

0 commit comments

Comments
 (0)