1
|
<?php
|
2
|
|
3
|
namespace Illuminate\Bus;
|
4
|
|
5
|
use Illuminate\Support\ServiceProvider;
|
6
|
|
7
|
class BusServiceProvider extends ServiceProvider
|
8
|
{
|
9
|
/**
|
10
|
* Indicates if loading of the provider is deferred.
|
11
|
*
|
12
|
* @var bool
|
13
|
*/
|
14
|
protected $defer = true;
|
15
|
|
16
|
/**
|
17
|
* Register the service provider.
|
18
|
*
|
19
|
* @return void
|
20
|
*/
|
21
|
public function register()
|
22
|
{
|
23
|
$this->app->singleton('Illuminate\Bus\Dispatcher', function ($app) {
|
24
|
return new Dispatcher($app, function ($connection = null) use ($app) {
|
25
|
return $app['Illuminate\Contracts\Queue\Factory']->connection($connection);
|
26
|
});
|
27
|
});
|
28
|
|
29
|
$this->app->alias(
|
30
|
'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\Dispatcher'
|
31
|
);
|
32
|
|
33
|
$this->app->alias(
|
34
|
'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher'
|
35
|
);
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Get the services provided by the provider.
|
40
|
*
|
41
|
* @return array
|
42
|
*/
|
43
|
public function provides()
|
44
|
{
|
45
|
return [
|
46
|
'Illuminate\Bus\Dispatcher',
|
47
|
'Illuminate\Contracts\Bus\Dispatcher',
|
48
|
'Illuminate\Contracts\Bus\QueueingDispatcher',
|
49
|
];
|
50
|
}
|
51
|
}
|