how do i count the number of unread notification in laravel that have a specific value

  laravel, laravel-notification, php

I am trying to count how many unread notifications i have in laravel that does not have a name value of the user that is logged in.

so far i have managed to do the following where i get the number of all the unread notifications:


but i want to only count the ones that have a name value that is not equal to the name of the user that is logged in

i have come up with something like this but its not working and i am not sure how to do not equal to rather than equal to:

  $numberofnotifications = auth()->user()->unreadNotifications::where('name', Auth::user()->name)->count();

Source: Laravel

Leave a Reply