QueuedCommand.php
848 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Illuminate\Foundation\Console;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Console\Kernel as KernelContract;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class QueuedCommand implements ShouldQueue
{
use Dispatchable, Queueable;
/**
* The data to pass to the Artisan command.
*
* @var array
*/
protected $data;
/**
* Create a new job instance.
*
* @param array $data
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Handle the job.
*
* @param \Illuminate\Contracts\Console\Kernel $kernel
* @return void
*/
public function handle(KernelContract $kernel)
{
$kernel->call(...array_values($this->data));
}
}