<?php
// Load the bootstrap file that defines base classes like kernels and error handler
$app = require_once dirname(__DIR__, 2) . '/bootstrap/app.php';

(new \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables())->bootstrap($app);
(new \Illuminate\Foundation\Bootstrap\LoadConfiguration())->bootstrap($app);
(new \Illuminate\Foundation\Bootstrap\RegisterFacades())->bootstrap($app);
(new \Illuminate\Foundation\Bootstrap\RegisterProviders())->bootstrap($app);

// Bind 'request' before booting providers — Telescope (and other providers)
// resolve $app['request'] during boot(), and this hybrid bootstrap does not
// go through Laravel's HTTP kernel that would normally register it first.
$app->singleton('request', function () {
    return \Illuminate\Http\Request::capture();
});

(new \Illuminate\Foundation\Bootstrap\BootProviders())->bootstrap($app);

require_once $path . 'core/includes/settings.php';

// set environment
$app['env'] = config('app.env');

(new \Mtcmedia\Mailer\MailerServiceProvider($app))->register();

return $app;

