get() ->map(function ($jenisForm) { return [ 'kode_form' => $jenisForm->kode_form, 'nama_form' => $jenisForm->nama_form, 'total' => $jenisForm->permohonan_count, ]; }); return view('welcome', compact('formCounts')); } // public function headerNotification() // { // $user = Auth::user(); // // Ambil permohonan terbaru oleh user yang login // $permohonanTerbaru = Permohonan::with('jenisForm') // ->where('nik', $user->nik) // ->whereDate('created_at', now()->toDateString()) // Hanya hari ini // ->latest() // ->first(); // $notification = null; // if ($permohonanTerbaru && $permohonanTerbaru->jenisForm?->kode_form === 'S1000') { // $tanggal = \Carbon\Carbon::parse($permohonanTerbaru->created_at)->format('d M Y'); // $notification = "Kamu baru saja membuat permohonan firewall pada tanggal $tanggal."; // } // return view('dashboard.index', compact('notification')); // } }