From 091e5593f9734d285a5175945eddf8cec7ae483f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 16 Dec 2017 22:13:53 -0600 Subject: [PATCH] Class bootstrapper fix --- bootstrap/app.php | 72 ++------------------------------------- bootstrap/application.php | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 70 deletions(-) create mode 100644 bootstrap/application.php diff --git a/bootstrap/app.php b/bootstrap/app.php index 69bcd661..9f9788b4 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -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; diff --git a/bootstrap/application.php b/bootstrap/application.php new file mode 100644 index 00000000..c2ebc46f --- /dev/null +++ b/bootstrap/application.php @@ -0,0 +1,69 @@ +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); + } +}