1
|
<?php
|
2
|
|
3
|
namespace Illuminate\Queue;
|
4
|
|
5
|
use Illuminate\Support\ServiceProvider;
|
6
|
use Illuminate\Queue\Console\RetryCommand;
|
7
|
use Illuminate\Queue\Console\ListFailedCommand;
|
8
|
use Illuminate\Queue\Console\FlushFailedCommand;
|
9
|
use Illuminate\Queue\Console\ForgetFailedCommand;
|
10
|
|
11
|
class ConsoleServiceProvider extends ServiceProvider
|
12
|
{
|
13
|
/**
|
14
|
* Indicates if loading of the provider is deferred.
|
15
|
*
|
16
|
* @var bool
|
17
|
*/
|
18
|
protected $defer = true;
|
19
|
|
20
|
/**
|
21
|
* Register the service provider.
|
22
|
*
|
23
|
* @return void
|
24
|
*/
|
25
|
public function register()
|
26
|
{
|
27
|
$this->app->singleton('command.queue.failed', function () {
|
28
|
return new ListFailedCommand;
|
29
|
});
|
30
|
|
31
|
$this->app->singleton('command.queue.retry', function () {
|
32
|
return new RetryCommand;
|
33
|
});
|
34
|
|
35
|
$this->app->singleton('command.queue.forget', function () {
|
36
|
return new ForgetFailedCommand;
|
37
|
});
|
38
|
|
39
|
$this->app->singleton('command.queue.flush', function () {
|
40
|
return new FlushFailedCommand;
|
41
|
});
|
42
|
|
43
|
$this->commands(
|
44
|
'command.queue.failed', 'command.queue.retry',
|
45
|
'command.queue.forget', 'command.queue.flush'
|
46
|
);
|
47
|
}
|
48
|
|
49
|
/**
|
50
|
* Get the services provided by the provider.
|
51
|
*
|
52
|
* @return array
|
53
|
*/
|
54
|
public function provides()
|
55
|
{
|
56
|
return [
|
57
|
'command.queue.failed', 'command.queue.retry',
|
58
|
'command.queue.forget', 'command.queue.flush',
|
59
|
];
|
60
|
}
|
61
|
}
|