getNotRead() public method

Get notifications not read of the entity given.
public getNotRead ( $toId, $limit = null, integer | null $paginate = null, string $orderDate = 'desc', Closur\Closure $filterScope = null ) : mixed
$toId
$limit
$paginate integer | null
$orderDate string
$filterScope Closur\Closure
return mixed
 /** @test */
 function it_retrieve_notification_by_paginating_the_number()
 {
     app('config')->set('notifynder.polymorphic', false);
     $extraValues = json_encode(['look' => 'Amazing']);
     $category = $this->createCategory(['text' => 'parse this {extra.look} value']);
     $notification = $this->createNotification(['extra' => $extraValues, 'category_id' => $category->id]);
     $notifications = $this->notification->getNotRead($notification->to->id, 10, true);
     $bodyParsed = 'parse this Amazing value';
     $this->assertEquals($bodyParsed, $notifications->items()[0]->text);
 }
示例#2
0
 /** @test */
 public function it_retrieve_notifications_toarray()
 {
     $extraValues = json_encode(['look' => 'Amazing']);
     $category = $this->createCategory(['text' => 'parse this {extra.look} value']);
     $notification = $this->createNotification(['extra' => $extraValues, 'category_id' => $category->id]);
     $notifications = $this->notification->getNotRead($notification->to->id)->toArray();
     $this->assertInternalType('array', $notifications);
     $this->assertCount(1, $notifications);
     $this->assertInternalType('array', $notifications[0]);
     $this->assertArrayHasKey('extra', $notifications[0]);
     $this->assertInternalType('array', $notifications[0]['extra']);
     $this->assertEquals('Amazing', $notifications[0]['extra']['look']);
 }