public function onMarkRead() { if (($id = post('id')) != '') { if ($notification = Notification::find($id)) { $notification->markAsRead(); } } $count = $this->getUnreadCount(); $count = $count > 0 ? $count : ''; $this->prepareVars(); return ['#notification-counter .badge' => $count]; }