sendNow() public method

Send now whatever data passed.
public sendNow ( array $info, $category = null ) : mixed
$info array
$category
return mixed
Beispiel #1
0
 /** @test */
 function it_send_now_a_mutiple_notification()
 {
     $category_name = 'my.category';
     $this->createCategory(['name' => $category_name]);
     $user_ids = [1, 2];
     $sendMultiple = $this->builder->loop($user_ids, function (NotifynderBuilder $builder, $value) use($category_name) {
         return $builder->category($category_name)->to($value)->from(2)->url('www.notifynder.io')->toArray();
     });
     // Send Single
     $this->senders->sendNow($sendMultiple);
     $this->assertCount(2, Notification::all());
 }
Beispiel #2
0
 /**
  * Send immediately the notification
  * even if the queue is enabled.
  *
  * @param  array $info
  * @return mixed
  */
 public function sendNow($info = [])
 {
     $info = count($info) > 0 ? $info : $this->toArray();
     $notificationsSent = $this->notifynderSender->sendNow($info, $this->defaultCategory);
     $this->refresh();
     return $notificationsSent;
 }
Beispiel #3
0
 /** @test */
 public function it_send_now_a_mutiple_notification()
 {
     $category_name = 'my.category';
     $this->createCategory(['name' => $category_name]);
     $user_ids = [1, 2];
     $sendMultiple = $this->builder->loop($user_ids, function (NotifynderBuilder $builder, $value) use($category_name) {
         return $builder->category($category_name)->to($value)->from(2)->url('www.notifynder.io')->toArray();
     });
     // Send Single
     $this->senders->sendNow($sendMultiple);
     $stackIds = Notification::lists('stack_id');
     if ($stackIds instanceof \Illuminate\Support\Collection) {
         $stackIds = $stackIds->toArray();
     }
     $stackIds = array_unique($stackIds);
     $this->assertCount(2, Notification::all());
     $this->assertCount(1, $stackIds);
     $this->assertEquals([1], $stackIds);
 }
 /**
  * Send immediately the notification
  * even if the queue is enabled
  *
  * @param  array $info
  * @return mixed
  */
 public function sendNow($info = [])
 {
     $info = count($info) > 0 ? $info : $this->toArray();
     return $this->notifynderSender->sendNow($info, $this->defaultCategory);
 }