canManage('settings')) { $backupsCount = count(app(BackupService::class)->list()); } $stats = [ 'individui' => Individuo::count(), 'gruppi' => Gruppo::count(), 'backups' => $backupsCount, 'notifiche' => $user->unreadNotificheCount(), 'documenti' => Documento::count(), 'eventi' => Evento::count(), 'email_nuove' => EmailMessage::where('is_read', false)->where('is_trash', false)->count(), 'mailing_liste' => MailingList::count(), ]; $notifiche = $user->notifiche()->take(5)->get(); return view('home.dashboard', compact('stats', 'notifiche')); } }