|
1
|
|
|
<?php namespace Rocket\Taxonomy\Support\Laravel5; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Contracts\Support\DeferrableProvider; |
|
4
|
|
|
use Rocket\Taxonomy\Repositories\TermRepositoryInterface; |
|
5
|
|
|
use Rocket\Taxonomy\Repositories\TermRepository; |
|
6
|
|
|
use Rocket\Taxonomy\Repositories\TermHierarchyRepositoryInterface; |
|
7
|
|
|
use Rocket\Taxonomy\Repositories\TermHierarchyRepository; |
|
8
|
|
|
use Rocket\Taxonomy\Taxonomy; |
|
9
|
|
|
use Rocket\Taxonomy\TaxonomyInterface; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Taxonomy Service Provider |
|
13
|
|
|
*/ |
|
14
|
|
|
class ServiceProvider extends \Illuminate\Support\ServiceProvider implements DeferrableProvider |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Register the service provider. |
|
19
|
|
|
* |
|
20
|
|
|
* @return void |
|
21
|
|
|
*/ |
|
22
|
|
|
public function register() |
|
23
|
225 |
|
{ |
|
24
|
|
|
$this->app->bind(TermRepositoryInterface::class, TermRepository::class); |
|
25
|
225 |
|
$this->app->bind(TermHierarchyRepositoryInterface::class, TermHierarchyRepository::class); |
|
26
|
225 |
|
$this->app->bind(TaxonomyInterface::class, Taxonomy::class); |
|
27
|
225 |
|
$this->app->alias('i18n', \Rocket\Translation\Taxonomy::class); |
|
28
|
|
|
$this->app->singleton( |
|
29
|
225 |
|
'taxonomy', |
|
30
|
192 |
|
function ($app) { |
|
31
|
192 |
|
return $app->make(Taxonomy::class); |
|
32
|
|
|
} |
|
33
|
225 |
|
); |
|
34
|
225 |
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Get the services provided by the provider. |
|
38
|
|
|
* |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
6 |
|
public function provides() |
|
42
|
|
|
{ |
|
43
|
6 |
|
return [ |
|
44
|
|
|
'taxonomy', |
|
45
|
|
|
TaxonomyInterface::class, |
|
46
|
|
|
Taxonomy::class, |
|
47
|
|
|
TermRepositoryInterface::class, |
|
48
|
|
|
TermRepository::class, |
|
49
|
|
|
TermHierarchyRepositoryInterface::class, |
|
50
|
|
|
TermHierarchyRepository::class |
|
51
|
|
|
]; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* {@inheritdoc} |
|
56
|
|
|
*/ |
|
57
|
|
|
public function boot() |
|
58
|
|
|
{ |
|
59
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../../migrations'); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|