/**
  * Execute the console command.
  */
 public function handle()
 {
     VkRequest::all()->groupBy('token')->each(function (Collection $requests, $token) {
         foreach ($requests->chunk(self::NUMBER_OF_REQUESTS) as $chunkRequests) {
             $this->dispatch(new SendBatch($chunkRequests, $token));
         }
     });
 }
 /**
  * Create a new job instance.
  *
  * @param Collection $requests
  * @param string $token Access token for Vk.com API
  */
 public function __construct(Collection $requests, $token)
 {
     $this->requests = $requests;
     $this->token = (string) $token;
     VkRequest::whereIn('id', $requests->pluck('id')->all())->delete();
 }
示例#3
0
 /**
  * Create a new job instance.
  *
  * @param VkRequest $request
  */
 public function __construct(VkRequest $request)
 {
     $this->request = $request;
     $request->delete();
 }