Just a quick way to get a count of related models. There actually is not function called ->whereNotHas(), only ->whereHas() and ->has() so you can use ->has(). The code gets a count of users without an assigned role, this is just an example but shows how it can be done.
//without an assigned role
$data["users"]["no_role"] = User::isActive()
->has('roles', '=', 0)