public countNotRead ( $toId, $entity, Closur\Closure $filterScope = null ) : mixed | ||
$toId | ||
$entity | ||
$filterScope | Closur\Closure | |
리턴 | mixed |
public function countNotRead($toId, $entity, Closure $filterScope = null)
{
$query = $this->notification->wherePolymorphic($toId, $entity)->withNotRead()->select($this->db->raw('Count(*) as notRead'));
$query = $this->applyFilter($filterScope, $query);
return $query->count();
}
/** @test */ function it_count_notification_not_read() { $this->createMultipleNotifications(); $countNotRead = $this->notificationRepo->countNotRead($this->to['id'], $this->to['type']); $this->assertEquals($this->multiNotificationsNumber, $countNotRead); }