public function readAll($toId, $entity) { return $this->notification->withNotRead()->wherePolymorphic($toId, $entity)->update(['read' => 1]); }
/** @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); }