Пример #1
0
 /**
  * Queue a new e-mail message for sending.
  *
  * @param  string|array  $view
  * @param  array  $data
  * @param  \Closure|string  $callback
  * @param  string|null  $queue
  * @return mixed
  */
 public function queue($view, array $data = [], $callback = null, $queue = null)
 {
     if ($view instanceof MailableContract) {
         return $view->queue($this->queue);
     }
     return $this->queue->pushOn($queue, new Jobs\HandleQueuedMessage($view, $data, $callback));
 }
Пример #2
0
 /**
  * @param string $queue
  * @param string|null $subject
  * @param string|null $template
  * @return bool
  */
 public function queue($queue, $subject = null, $template = null)
 {
     if (null !== $subject) {
         $this->setSubject($subject);
     }
     if (null !== $template) {
         $this->setTemplate($template);
     }
     $this->queue->pushOn($queue, new Job($this->getData()));
     return true;
 }
Пример #3
0
 /**
  * Push the command onto the given queue instance.
  *
  * @param  \Illuminate\Contracts\Queue\Queue  $queue
  * @param  mixed  $command
  * @return mixed
  */
 protected function pushCommandToQueue($queue, $command)
 {
     if (isset($command->queue, $command->delay)) {
         return $queue->laterOn($command->queue, $command->delay, $command);
     }
     if (isset($command->queue)) {
         return $queue->pushOn($command->queue, $command);
     }
     if (isset($command->delay)) {
         return $queue->later($command->delay, $command);
     }
     return $queue->push('Ahead4\\Bus\\CallQueuedHandler@call', ['pipes' => $this->pipes, 'command' => serialize($command)]);
 }
Пример #4
0
 /**
  * Push the command onto the given queue instance.
  *
  * @param  \Illuminate\Contracts\Queue\Queue  $queue
  * @param  mixed  $command
  * @return mixed
  */
 protected function pushCommandToQueue($queue, $command)
 {
     if (isset($command->queue, $command->delay)) {
         return $queue->laterOn($command->queue, $command->delay, $command);
     }
     if (isset($command->queue)) {
         return $queue->pushOn($command->queue, $command);
     }
     if (isset($command->delay)) {
         return $queue->later($command->delay, $command);
     }
     return $queue->push($command);
 }
Пример #5
0
 public function it_pushes_mail_to_queue(Queue $queue)
 {
     $recipient = new Recipient('Jane Doe', '*****@*****.**');
     $variableOne = new Variable('global_one', 'Example');
     $variableTwo = new Variable('global_two', 'Another example');
     $variableThree = new Variable('local', 'Yet another example');
     $attachment = new Attachment('text/csv', 'test.csv', 'example;test;');
     $data = ['from_name' => 'John Doe', 'from_email' => '*****@*****.**', 'subject' => 'Example subject', 'template' => 'example template', 'recipients' => [new Recipient('Jane Doe', '*****@*****.**')], 'global_vars' => ['global_one' => ['name' => 'GLOBAL_ONE', 'content' => 'Example'], 'global_two' => ['name' => 'GLOBAL_TWO', 'content' => 'Another example']], 'local_vars' => ['*****@*****.**' => ['local' => ['name' => 'LOCAL', 'content' => 'Yet another example']]], 'headers' => [], 'attachments' => [['type' => 'text/csv', 'name' => 'test.csv', 'content' => 'ZXhhbXBsZTt0ZXN0Ow==']]];
     $this->setSubject('Example subject');
     $this->setTemplate('example template');
     $this->addRecipient($recipient);
     $this->addGlobalVariable($variableOne);
     $this->addGlobalVariable($variableTwo);
     $this->addLocalVariable($recipient, $variableThree);
     $this->addAttachment($attachment);
     $job = new Job($data);
     $queue->pushOn('mandrill', $job)->shouldBeCalled();
     $this->queue('mandrill')->shouldReturn(true);
 }
Пример #6
0
 /**
  * Push command to queue.
  *
  * @param \Illuminate\Contracts\Queue\Queue $queue
  * @param \Krucas\Counter\Integration\Laravel\Commands\Base $command
  * @return void
  */
 public function queue(Queue $queue, Base $command)
 {
     if (!is_null($this->queue)) {
         $queue->pushOn($this->queue, $command);
     } else {
         $queue->push($command);
     }
 }
Пример #7
0
 public function it_pushes_mail_to_queue(Queue $queue)
 {
     $recipient = new Recipient('Jane Doe', '*****@*****.**');
     $variableOne = new Variable('global_one', 'Example');
     $variableTwo = new Variable('global_two', 'Another example');
     $variableThree = new Variable('local', 'Yet another example');
     $data = ['from_name' => 'Master Jedi Yoda', 'from_email' => '*****@*****.**', 'subject' => 'Example subject', 'template' => 'example template', 'recipients' => ['*****@*****.**' => $recipient], 'global_vars' => ['global_one' => 'Example', 'global_two' => 'Another example'], 'local_vars' => ['*****@*****.**' => [$variableThree]], 'headers' => [], 'reply_to' => null, 'attachments' => []];
     $this->setSubject('Example subject');
     $this->setTemplate('example template');
     $this->addRecipient($recipient);
     $this->addGlobalVariable($variableOne);
     $this->addGlobalVariable($variableTwo);
     $this->addLocalVariable($recipient, $variableThree);
     $job = new Job($data);
     $queue->pushOn('sendgrid', $job)->shouldBeCalled();
     $this->queue('sendgrid')->shouldReturn(true);
 }