2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
|
2017-08-15 07:41:55 +08:00
|
|
|
if(!defined('LUMEN_START')) {
|
|
|
|
define('LUMEN_START', microtime(true));
|
|
|
|
}
|
2017-08-15 07:26:20 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
if (!defined('DS')) {
|
|
|
|
define('DS', DIRECTORY_SEPARATOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Customized container to allow some of the base Laravel
|
|
|
|
* configurations to be overridden
|
|
|
|
*/
|
|
|
|
class App extends Illuminate\Foundation\Application
|
|
|
|
{
|
|
|
|
public function __construct(string $basePath = null)
|
|
|
|
{
|
|
|
|
parent::__construct(dirname(__DIR__) . '/');
|
2017-06-09 02:28:26 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
$this->loadEnvironmentFrom('.env');
|
|
|
|
$this->useDatabasePath($this->basePath . '/app/Database');
|
|
|
|
$this->useStoragePath($this->basePath . '/storage');
|
2017-12-15 00:56:30 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
$this->bind('path.public', function () {
|
|
|
|
return __DIR__ . '/../public';
|
|
|
|
});
|
|
|
|
}
|
2017-12-15 00:38:10 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function bindInterfaces()
|
|
|
|
{
|
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Http\Kernel::class,
|
|
|
|
App\Http\Kernel::class
|
|
|
|
);
|
2017-06-09 02:28:26 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Console\Kernel::class,
|
|
|
|
App\Console\Kernel::class
|
|
|
|
);
|
2017-06-09 02:28:26 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
|
|
|
App\Exceptions\Handler::class
|
|
|
|
);
|
|
|
|
}
|
2017-06-09 02:28:26 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
/**
|
|
|
|
* Override paths
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function configPath($path = '')
|
|
|
|
{
|
|
|
|
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
|
|
|
|
}
|
|
|
|
|
2017-12-17 12:07:58 +08:00
|
|
|
public function environmentPath()
|
|
|
|
{
|
|
|
|
return $this->environmentPath ?: $this->basePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function langPath()
|
|
|
|
{
|
|
|
|
return $this->resourcePath() . DIRECTORY_SEPARATOR . 'lang';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function publicPath()
|
|
|
|
{
|
|
|
|
return $this->basePath . DS . 'public';
|
|
|
|
}
|
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
public function resourcePath($path = '')
|
|
|
|
{
|
|
|
|
return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path);
|
|
|
|
}
|
|
|
|
}
|
2017-06-09 02:28:26 +08:00
|
|
|
|
2017-12-17 12:02:45 +08:00
|
|
|
$app = new App();
|
|
|
|
$app->bindInterfaces();
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
return $app;
|