-
Notifications
You must be signed in to change notification settings - Fork 0
/
Provider.php
59 lines (51 loc) · 1.78 KB
/
Provider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace SaeService;
use Illuminate\Support\ServiceProvider;
class Provider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if (!defined('SAE_ACCESSKEY')) {
return;
}
//config log
$this->app->make('Psr\Log\LoggerInterface')->setHandlers(array(new Logger()));
//config db
$this->app['config']['database.connections.mysql.write.host'] = SAE_MYSQL_HOST_M;
$this->app['config']['database.connections.mysql.read.host'] = SAE_MYSQL_HOST_S;
$this->app['config']['database.connections.mysql.port'] = SAE_MYSQL_PORT;
$this->app['config']['database.connections.mysql.database'] = SAE_MYSQL_DB;
$this->app['config']['database.connections.mysql.username'] = SAE_MYSQL_USER;
$this->app['config']['database.connections.mysql.password'] = SAE_MYSQL_PASS;
//config cache
/** @var \Illuminate\Cache\CacheManager $CacheManager **/
$CacheManager = $this->app->make('cache');
$CacheManager->extend('sae', function($app){
return new Cache;
});
$CacheManager->setDefaultDriver('sae');
$this->app['config']['cache.stores.sae'] = array('driver' => 'sae');
//config session
/** @var \Illuminate\Session\SessionManager $SessionManager **/
/*
$SessionManager = $this->app->make('session');
$SessionManager->extend('sae', function($app){
return new Session;
});
$SessionManager->setDefaultDriver('sae');
*/
//config storage
/** @var \Illuminate\Filesystem\FilesystemManager $FilesystemManager **/
$FilesystemManager = $this->app->make('filesystem');
$FilesystemManager->extend('sae', function($app) {
return new Storage;
});
$this->app['config']['filesystems.default'] = 'sae';
$this->app['config']['filesystems.disks.sae'] = array('driver' => 'sae');
}
}