title: Laravel 7 Notifications & AJAX: Method markAsRead() does not update results on return
body: <p>I am implementing a dropdown menu with Database Notifications from Laravel's 7 Notifications. I want the user to be able to dismiss a notification without having to reload the page. My controller method is:</p>
  <pre><code>public function markAsRead($id) {
    auth()-&gt;user()-&gt;unreadNotifications-&gt;where('id', $id)-&gt;markAsRead();
  
    $notificationArray = array();
      $user = Auth::user();
      foreach ($user-&gt;unreadNotifications as $notification) {
          $notificationArray[] = $notification;
      }
  
    return view(&quot;layouts/notifications_list&quot;, [&quot;notifications&quot; =&gt; compact(&quot;notificationArray&quot;)]);
  }
  </code></pre>
  <p>My AJAX :</p>
  <pre><code>$.ajax({
       method: &quot;GET&quot;,
       url: ' {{ route('notifications.markNotificationAsRead', ['id']) }}'.replace('id', notificationId),
       cache: false,
        success: function(response) {
           $('#notifications-dropdown').empty();
           $('#notifications-dropdown').html(response);
  
       },
    });
  </code></pre>
  <p>What I get is the <strong>already</strong> rendered values. It is like the line <code>auth()-&gt;user()-&gt;unreadNotifications-&gt;where('id', $id)-&gt;markAsRead(); </code> is being ignored.
  However, when I refresh the page the list is updated.</p>