Ejemplo n.º 1
0
 /** @test */
 function it_send_with_an_custom_sender()
 {
     $this->senders->extend('sendCustom', function ($notification, $app) {
         return new CustomDefaultSender($notification, $app->make('notifynder'));
     });
     $category_name = 'my.category';
     $this->createCategory(['name' => $category_name]);
     $singleNotification = $this->builder->category($category_name)->to(1)->from(2)->url('www.notifynder.io')->toArray();
     $this->senders->sendCustom($singleNotification);
     $this->assertCount(1, Notification::all());
 }
Ejemplo n.º 2
0
 /**
  * Call the custom sender method
  *
  * @param $name
  * @param $arguments
  * @return void|mixed
  */
 public function __call($name, $arguments)
 {
     if (starts_with($name, 'send')) {
         $arguments = isset($arguments[0]) ? $arguments[0] : $this->toArray();
         return $this->notifynderSender->customSender($name, $arguments);
     }
     $error = "method [{$name}] not found in the class " . self::class;
     throw new BadMethodCallException($error);
 }
Ejemplo n.º 3
0
 /**
  * Send notification.
  *
  * @param NotifynderSender $sender
  * @return mixed
  */
 public function send(NotifynderSender $sender)
 {
     //        dd($storeNotification);
     return $sender->send($this->notifications);
 }