read_at = date('Y-m-d h:i:s'); $n->save(); } public function markAllAsRead() { $notifications = \Auth::user()->unreadNotifications; foreach ($notifications as $n) { $n->read_at = date('Y-m-d h:i:s'); $n->save(); } return $notifications; } }