K
K
Kirill2017-04-14 16:16:58
Message Queues
Kirill, 2017-04-14 16:16:58

How to pass your data to Laravel 5.3 Queue Queue?

How can I pass my data to the Queue so that when processing the queue in the handle () method, operations are performed on them?
I try to throw it as in the example, but my data only shows from the last queue, that is, if the element in the queue is 1, then everything is fine, but if more, then only the last $my_data is displayed.

class SendReminderEmail extends Job implements ShouldQueue
{
  use InteractsWithQueue, SerializesModels;

  protected $my_data;

  public function __construct($my_data)
  {
    $this->my_data = $my_data;
  }

  public function handle()
  {
   echo $my_data;
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2017-04-14
@Nc_Soft

public function handle()
  {
   echo $this->my_data;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question