diff options
Diffstat (limited to 'bootstrap/app.php')
-rw-r--r-- | bootstrap/app.php | 96 |
1 files changed, 21 insertions, 75 deletions
diff --git a/bootstrap/app.php b/bootstrap/app.php index c72ab23..f2801ad 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,109 +1,55 @@ <?php -require_once __DIR__.'/../vendor/autoload.php'; - -try { - (new Dotenv\Dotenv(__DIR__.'/../'))->load(); -} catch (Dotenv\Exception\InvalidPathException $e) { -} - /* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | -| Here we will load the environment and create the application instance -| that serves as the central piece of this framework. We'll use this -| application as an "IoC" container and router for this framework. +| 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. | */ -$app = new Laravel\Lumen\Application( - realpath(__DIR__.'/../') +$app = new Illuminate\Foundation\Application( + realpath(__DIR__.'/../') ); -$app->withFacades(); - -$app->withEloquent(); - /* |-------------------------------------------------------------------------- -| Register Container Bindings +| Bind Important Interfaces |-------------------------------------------------------------------------- | -| Now we will register a few bindings in the service container. We will -| register the exception handler and the console kernel. You may add -| your own bindings here if you like or you can make another file. +| 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\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class ); $app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class ); -/* -|-------------------------------------------------------------------------- -| Register Middleware -|-------------------------------------------------------------------------- -| -| Next, we will register the middleware with the application. These can -| be global middleware that run before and after each request into a -| route or middleware that'll be assigned to some specific routes. -| -*/ - -// $app->middleware([ -// // Illuminate\Cookie\Middleware\EncryptCookies::class, -// // Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, -// // Illuminate\Session\Middleware\StartSession::class, -// // Illuminate\View\Middleware\ShareErrorsFromSession::class, -// // Laravel\Lumen\Http\Middleware\VerifyCsrfToken::class, -// ]); - -$app->routeMiddleware([ - 'auth' => App\Http\Middleware\Authenticate::class, - 'login' => App\Http\Middleware\Login::class, -]); - -/* -|-------------------------------------------------------------------------- -| Register Service Providers -|-------------------------------------------------------------------------- -| -| Here we will register all of the application's service providers which -| are used to bind services into the container. Service providers are -| totally optional, so you are not required to uncomment this line. -| -*/ - -$app->register(App\Providers\AppServiceProvider::class); -$app->register(App\Providers\AuthServiceProvider::class); -// $app->register(App\Providers\EventServiceProvider::class); - -$app->register(Illuminate\Mail\MailServiceProvider::class); -$app->register(Arubacao\BasicAuth\BasicGuardServiceProvider::class); +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); /* |-------------------------------------------------------------------------- -| Load The Application Routes +| Return The Application |-------------------------------------------------------------------------- | -| Next we will include the routes file so that they can all be added to -| the application. This will provide all of the URLs the application -| can respond to, as well as the controllers that may handle them. +| 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. | */ -$app->group(['namespace' => 'App\Http\Controllers'], function ($app) { - require __DIR__.'/../app/Http/routes.php'; -}); - -$app->configure('mail'); - return $app; |