title: Group similar notifications in Laravel/Eloquent
body: <p>My notifications table looks like the following</p>
  
  <pre><code>id (eg. 1) | from_id (eg. 1) | from_type (eg. liked) | to_id (eg. 2) | to_type (comment) | item_id (eg. 1) | read (0 or 1) | created_at | updated_at
  </code></pre>
  
  <p>Currently when I fetch notifications in Laravel, I make this call </p>
  
  <pre><code>$notifs = Notification::with('from')
                          -&gt;where("to_id", "=", $user_id)
                          -&gt;where("read", "=", 0)
                          -&gt;limit(40)
                          -&gt;get();
  </code></pre>
  
  <p>This works perfectly, except I've decided to move on to grouping the notifications by type so that the user can get "13 people have liked you post" as opposed to 13 separate notifications saying that their post has been liked. </p>
  
  <p>Thanks in advance!</p>