feat: add bulk delete for ibadah and miskin with checkboxes (admin-only)
This commit is contained in:
@@ -72,4 +72,18 @@ class IbadahController extends Controller
|
||||
ActivityLog::record('delete', "Menghapus rumah ibadah: {$ibadah->nama}", 'ibadah', $id);
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
public function bulkDestroy(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'ids' => 'required|array|min:1',
|
||||
'ids.*' => 'integer',
|
||||
]);
|
||||
|
||||
$count = RumahIbadah::whereIn('id', $validated['ids'])->count();
|
||||
RumahIbadah::whereIn('id', $validated['ids'])->delete();
|
||||
|
||||
ActivityLog::record('bulk_delete', "Menghapus massal {$count} rumah ibadah", 'ibadah');
|
||||
return response()->json(['success' => true, 'deleted' => $count]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user