Replace the Application loader to facilitate moving the public/ dir to the root
This commit is contained in:
parent
d768589cb1
commit
7d414ce017
22
app/Console/Commands/Test.php
Normal file
22
app/Console/Commands/Test.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
|
||||||
|
class Test extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'phpvms:test';
|
||||||
|
protected $description = '';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
print resource_path();
|
||||||
|
}
|
||||||
|
}
|
@ -1,66 +1,69 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Create The Application
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The first thing we will do is create a new Laravel application instance
|
|
||||||
| which serves as the "glue" for all the components of Laravel, and is
|
|
||||||
| the IoC container for the system binding all of the various parts.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(!defined('LUMEN_START')) {
|
if(!defined('LUMEN_START')) {
|
||||||
define('LUMEN_START', microtime(true));
|
define('LUMEN_START', microtime(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
if (!defined('DS')) {
|
||||||
realpath(__DIR__.'/../')
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
);
|
}
|
||||||
|
|
||||||
$app->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');
|
$this->loadEnvironmentFrom('.env');
|
||||||
$app->useDatabasePath(realpath(__DIR__.'/../app/Database'));
|
$this->useDatabasePath($this->basePath . '/app/Database');
|
||||||
|
$this->useStoragePath($this->basePath . '/storage');
|
||||||
|
|
||||||
/*
|
$this->bind('path.public', function () {
|
||||||
|--------------------------------------------------------------------------
|
return __DIR__ . '/../public';
|
||||||
| 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.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$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(
|
$this->singleton(
|
||||||
Illuminate\Contracts\Console\Kernel::class,
|
Illuminate\Contracts\Console\Kernel::class,
|
||||||
App\Console\Kernel::class
|
App\Console\Kernel::class
|
||||||
);
|
);
|
||||||
|
|
||||||
$app->singleton(
|
$this->singleton(
|
||||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||||
App\Exceptions\Handler::class
|
App\Exceptions\Handler::class
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
* Override paths
|
||||||
| Return The Application
|
*/
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
public function configPath($path = '')
|
||||||
| This script returns the application instance. The instance is given to
|
{
|
||||||
| the calling script so we can separate the building of the instances
|
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
|
||||||
| from the actual running of the application and sending responses.
|
}
|
||||||
|
|
|
||||||
*/
|
public function resourcePath($path = '')
|
||||||
|
{
|
||||||
|
return $this->basePath . DS . 'resources' . ($path ? DS . $path : $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$app = new App();
|
||||||
|
$app->bindInterfaces();
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
|
Loading…
Reference in New Issue
Block a user