|
1
|
|
|
<?php namespace Arcanedev\Units; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\Support\PackageServiceProvider; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class UnitsServiceProvider |
|
7
|
|
|
* |
|
8
|
|
|
* @package Arcanedev\Units |
|
9
|
|
|
* @author ARCANEDEV <[email protected]> |
|
10
|
|
|
*/ |
|
11
|
|
|
class UnitsServiceProvider extends PackageServiceProvider |
|
12
|
|
|
{ |
|
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
14
|
|
|
| Properties |
|
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
16
|
|
|
*/ |
|
17
|
|
|
/** |
|
18
|
|
|
* Package name. |
|
19
|
|
|
* |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $package = 'units'; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Indicates if loading of the provider is deferred. |
|
26
|
|
|
* |
|
27
|
|
|
* @var bool |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $defer = true; |
|
30
|
|
|
|
|
31
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
32
|
|
|
| Getters & Setters |
|
33
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
34
|
|
|
*/ |
|
35
|
|
|
/** |
|
36
|
|
|
* Get the base path of the package. |
|
37
|
|
|
* |
|
38
|
|
|
* @return string |
|
39
|
|
|
*/ |
|
40
|
56 |
|
public function getBasePath() |
|
41
|
|
|
{ |
|
42
|
56 |
|
return dirname(__DIR__); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
46
|
|
|
| Main Functions |
|
47
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
48
|
|
|
*/ |
|
49
|
|
|
/** |
|
50
|
|
|
* Register the service provider. |
|
51
|
|
|
* |
|
52
|
|
|
* @return void |
|
53
|
|
|
*/ |
|
54
|
56 |
|
public function register() |
|
55
|
|
|
{ |
|
56
|
56 |
|
$this->registerConfig(); |
|
57
|
|
|
|
|
58
|
56 |
|
$this->singleton('arcanedev.units.manager', function ($app) { |
|
59
|
40 |
|
return new UnitsManager($app); |
|
60
|
56 |
|
}); |
|
61
|
|
|
|
|
62
|
56 |
|
$this->bind(Contracts\UnitsManager::class, 'arcanedev.units.manager'); |
|
63
|
56 |
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Boot the service provider. |
|
67
|
|
|
*/ |
|
68
|
56 |
|
public function boot() |
|
69
|
|
|
{ |
|
70
|
56 |
|
parent::boot(); |
|
71
|
|
|
|
|
72
|
56 |
|
$this->publishConfig(); |
|
73
|
56 |
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Get the services provided by the provider. |
|
77
|
|
|
* |
|
78
|
|
|
* @return array |
|
79
|
|
|
*/ |
|
80
|
16 |
|
public function provides() |
|
81
|
|
|
{ |
|
82
|
|
|
return [ |
|
83
|
16 |
|
'arcanedev.units.manager', |
|
84
|
12 |
|
Contracts\UnitsManager::class, |
|
85
|
12 |
|
]; |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|