Class bootstrapper fix
This commit is contained in:
parent
d964a3f0f3
commit
091e5593f9
@ -8,77 +8,9 @@ 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__) . '/');
|
||||
include_once __DIR__ . '/application.php';
|
||||
|
||||
$this->loadEnvironmentFrom('.env');
|
||||
$this->useDatabasePath($this->basePath . '/app/Database');
|
||||
$this->useStoragePath($this->basePath . '/storage');
|
||||
|
||||
$this->bind('path.public', function () {
|
||||
return __DIR__ . '/../public';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
||||
public function configPath($path = '')
|
||||
{
|
||||
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
public function resourcePath($path = '')
|
||||
{
|
||||
return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
$app = new App();
|
||||
$app = new Application();
|
||||
$app->bindInterfaces();
|
||||
|
||||
return $app;
|
||||
|
69
bootstrap/application.php
Normal file
69
bootstrap/application.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application as LaravelApplication;
|
||||
|
||||
/**
|
||||
* Customized container to allow some of the base Laravel
|
||||
* configurations to be overridden
|
||||
*/
|
||||
class Application extends LaravelApplication
|
||||
{
|
||||
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
|
||||
*/
|
||||
|
||||
public function configPath($path = '')
|
||||
{
|
||||
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
public function resourcePath($path = '')
|
||||
{
|
||||
return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user