2017-12-17 12:13:53 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Application as LaravelApplication;
|
|
|
|
|
2017-12-17 15:03:19 +08:00
|
|
|
if (!defined('DS')) {
|
|
|
|
define('DS', DIRECTORY_SEPARATOR);
|
|
|
|
}
|
|
|
|
|
2017-12-17 12:13:53 +08:00
|
|
|
/**
|
|
|
|
* Customized container to allow some of the base Laravel
|
|
|
|
* configurations to be overridden
|
|
|
|
*/
|
|
|
|
class Application extends LaravelApplication
|
|
|
|
{
|
2017-12-17 15:03:19 +08:00
|
|
|
private $publicPath;
|
|
|
|
|
2017-12-17 12:13:53 +08:00
|
|
|
public function __construct(string $basePath = null)
|
|
|
|
{
|
|
|
|
parent::__construct(dirname(__DIR__) . '/');
|
|
|
|
|
|
|
|
$this->loadEnvironmentFrom('.env');
|
|
|
|
$this->useDatabasePath($this->basePath . '/app/Database');
|
|
|
|
$this->useStoragePath($this->basePath . '/storage');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function bindInterfaces()
|
|
|
|
{
|
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Http\Kernel::class,
|
|
|
|
App\Http\Kernel::class
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Console\Kernel::class,
|
|
|
|
App\Console\Kernel::class
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->singleton(
|
|
|
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
|
|
|
App\Exceptions\Handler::class
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override paths
|
|
|
|
*/
|
|
|
|
|
2017-12-17 15:03:19 +08:00
|
|
|
public function setPublicPath($publicPath)
|
|
|
|
{
|
|
|
|
$this->publicPath = $publicPath;
|
|
|
|
}
|
|
|
|
|
2017-12-17 12:13:53 +08:00
|
|
|
public function configPath($path = '')
|
|
|
|
{
|
|
|
|
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function environmentPath()
|
|
|
|
{
|
|
|
|
return $this->environmentPath ?: $this->basePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function langPath()
|
|
|
|
{
|
2017-12-17 12:19:17 +08:00
|
|
|
return $this->resourcePath() . DS . 'lang';
|
2017-12-17 12:13:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function publicPath()
|
|
|
|
{
|
2017-12-17 15:03:19 +08:00
|
|
|
return $this->publicPath ?: $this->basePath . DS . 'public';
|
2017-12-17 12:13:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function resourcePath($path = '')
|
|
|
|
{
|
|
|
|
return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path);
|
|
|
|
}
|
|
|
|
}
|