1
|
|
|
<?php namespace Arcanesoft\Core; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Core\Bases\PackageServiceProvider; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class FoundationServiceProvider |
7
|
|
|
* |
8
|
|
|
* @package Arcanesoft\Foundation |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class CoreServiceProvider extends PackageServiceProvider |
12
|
|
|
{ |
13
|
|
|
/* ----------------------------------------------------------------- |
14
|
|
|
| Properties |
15
|
|
|
| ----------------------------------------------------------------- |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Package name. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected $package = 'core'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Register the core service provider. |
27
|
|
|
* |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
protected $registerCoreServiceProvider = false; |
31
|
|
|
|
32
|
|
|
/* ----------------------------------------------------------------- |
33
|
|
|
| Main Methods |
34
|
|
|
| ----------------------------------------------------------------- |
35
|
|
|
*/ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Register the service provider. |
39
|
|
|
*/ |
40
|
147 |
|
public function register() |
41
|
|
|
{ |
42
|
147 |
|
parent::register(); |
43
|
|
|
|
44
|
147 |
|
$this->registerConfig(); |
45
|
147 |
|
$this->registerArcanesoftDatabase(); |
46
|
147 |
|
$this->registerProviders([ |
47
|
147 |
|
Providers\AuthorizationServiceProvider::class, |
48
|
49 |
|
Providers\PackagesServiceProvider::class, |
49
|
49 |
|
]); |
50
|
147 |
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Boot the service provider. |
54
|
|
|
*/ |
55
|
147 |
|
public function boot() |
56
|
|
|
{ |
57
|
147 |
|
parent::boot(); |
58
|
|
|
|
59
|
147 |
|
$this->registerProvider(Providers\RouteServiceProvider::class); |
60
|
|
|
|
61
|
147 |
|
$this->publishViews(); |
62
|
147 |
|
$this->publishTranslations(); |
63
|
147 |
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Get the services provided by the provider. |
67
|
|
|
* |
68
|
|
|
* @return array |
69
|
|
|
*/ |
70
|
3 |
|
public function provides() |
71
|
|
|
{ |
72
|
|
|
return [ |
73
|
|
|
// |
74
|
3 |
|
]; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/* ----------------------------------------------------------------- |
78
|
|
|
| Services Methods |
79
|
|
|
| ----------------------------------------------------------------- |
80
|
|
|
*/ |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Register Foundation database. |
84
|
|
|
*/ |
85
|
147 |
|
private function registerArcanesoftDatabase() |
86
|
|
|
{ |
87
|
|
|
// Keep it or using a real DBMS ? |
88
|
147 |
|
$connection = $this->config()->get('core.database.default', 'sqlite'); |
89
|
|
|
|
90
|
147 |
|
$this->config()->set( |
91
|
147 |
|
'database.connections.arcanesoft', |
92
|
147 |
|
$this->config()->get("core.database.connections.{$connection}") |
93
|
49 |
|
); |
94
|
147 |
|
} |
95
|
|
|
} |
96
|
|
|
|