Fenos\Notifynder\Notifications\NotificationRepository::readAll PHP Method

readAll() public method

Make read all notification not read.
public readAll ( $toId, $entity ) : integer
$toId
$entity
return integer
    public function readAll($toId, $entity)
    {
        return $this->notification->withNotRead()->wherePolymorphic($toId, $entity)->update(['read' => 1]);
    }

Usage Example

 /** @test */
 function it_read_all_the_notifications_of_the_given_entity()
 {
     $this->createMultipleNotifications();
     $notificationRead = $this->notificationRepo->readAll($this->to['id'], $this->to['type']);
     $this->assertEquals(10, $notificationRead);
 }