selectRaw("SUM(CASE WHEN cash_categories.name = 'pemasukan' THEN amount ELSE -amount END) as saldo") ->value('saldo') ?? 0; return [ Stat::make('Anggota Aktif', User::where('status', 'aktif')->count()) ->icon('heroicon-o-users') ->color('success'), Stat::make('Total Kas', 'Rp ' . number_format($totalKas, 0, ',', '.')) ->icon('heroicon-o-banknotes') ->color($totalKas >= 0 ? 'success' : 'danger'), Stat::make('Kegiatan Berjalan', Activity::where('status', 'approved') ->whereNull('executed_at')->count()) ->icon('heroicon-o-calendar-days') ->color('info'), Stat::make('Kegiatan Pending', Activity::where('status', 'pending')->count()) ->icon('heroicon-o-clock') ->color('warning'), ]; } }