diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php new file mode 100644 index 00000000..893a0346 --- /dev/null +++ b/app/Console/Commands/Test.php @@ -0,0 +1,22 @@ +bind('path.public', function () { - return __DIR__.'/../public'; -}); +/** + * 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__) . '/'); -#$app->loadEnvironmentFrom('.env.php'); -$app->useDatabasePath(realpath(__DIR__.'/../app/Database')); + $this->loadEnvironmentFrom('.env'); + $this->useDatabasePath($this->basePath . '/app/Database'); + $this->useStoragePath($this->basePath . '/storage'); -/* -|-------------------------------------------------------------------------- -| Bind Important Interfaces -|-------------------------------------------------------------------------- -| -| Next, we need to bind some important interfaces into the container so -| we will be able to resolve them when needed. The kernels serve the -| incoming requests to this application from both the web and CLI. -| -*/ + $this->bind('path.public', function () { + return __DIR__ . '/../public'; + }); + } -$app->singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class -); + /** + * + */ + public function bindInterfaces() + { + $this->singleton( + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class + ); -$app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class -); + $this->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class + ); -$app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class -); + $this->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class + ); + } -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ + /** + * Override paths + */ + + public function configPath($path = '') + { + return $this->basePath . DS . 'config' . ($path ? DS . $path : $path); + } + + public function resourcePath($path = '') + { + return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path); + } +} + +$app = new App(); +$app->bindInterfaces(); return $app;