fix bootstrapers

This commit is contained in:
printempw 2016-08-29 14:22:53 +08:00
parent cebae55ca5
commit f7fd47f2d6
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php
define('BASE_DIR', __DIR__);
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
@ -13,9 +15,9 @@
|
*/
require __DIR__.'/bootstrap/autoload.php';
require BASE_DIR.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$app = require_once BASE_DIR.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------

View File

@ -7,7 +7,6 @@
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
// Define Base Directory
define('BASE_DIR', __DIR__);
/*

View File

@ -34,9 +34,9 @@ Illuminate\Support\Facades\Facade::setFacadeApplication($app);
(new Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app);
(new Illuminate\Database\DatabaseServiceProvider($app))->register();
(new Illuminate\Filesystem\FilesystemServiceProvider($app))->register();
(new Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app);
$app->singleton('database', \App\Services\Database\Database::class);
$app->singleton('database', App\Services\Database\Database::class);
$app->singleton('option', App\Services\OptionRepository::class);
require BASE_DIR.'/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php';
@ -47,21 +47,21 @@ foreach ($config['aliases'] as $facade => $class) {
class_alias($class, $facade);
}
\View::addExtension('tpl', 'blade');
View::addExtension('tpl', 'blade');
$config = require BASE_DIR.'/config/database.php';
$db_config = $config['connections']['mysql'];
// Check Database Config
@$conn = new \mysqli($db_config['host'], $db_config['username'], $db_config['password'], $db_config['database'], $db_config['port']);
@$conn = new mysqli($db_config['host'], $db_config['username'], $db_config['password'], $db_config['database'], $db_config['port']);
if ($conn->connect_error) {
throw new App\Exceptions\E("无法连接至 MySQL 服务器,请检查你的配置:".$conn->connect_error, $conn->connect_errno, true);
}
// Boot Eloquent ORM
$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule = new Illuminate\Database\Capsule\Manager;
$capsule->addConnection($db_config);
$capsule->setAsGlobal();
$capsule->bootEloquent();