Skip to content

Commit 5866f6e

Browse files
committed
Add year filter and kerangkaAcuan count to DaftarSp2d index query: Enhance data retrieval
1 parent 6f26e9a commit 5866f6e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

app/Models/DaftarSp2d.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,4 @@ public function realisasiAnggaran(): HasMany
2424
{
2525
return $this->hasMany(RealisasiAnggaran::class);
2626
}
27-
28-
protected static function booted(): void
29-
{
30-
static::addGlobalScope('with-kerangka-acuan-count', function (Builder $builder) {
31-
$builder->whereYear('tanggal_sp2d',session('year'))->withCount('kerangkaAcuan');
32-
});
33-
}
3427
}

app/Nova/DaftarSp2d.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,9 @@ public function actions(NovaRequest $request)
182182
{
183183
return [];
184184
}
185+
186+
public static function indexQuery(NovaRequest $request, $query)
187+
{
188+
$query->whereYear('tanggal_sp2d',session('year'))->withCount('kerangkaAcuan');
189+
}
185190
}

0 commit comments

Comments
 (0)