<?php

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// --- AUTOMATIC INSTALLER LOGIC ---
// If the .env file is missing, automatically load the installer UI.
// Once the installer finishes and generates .env, it locks itself out.
if (!file_exists(__DIR__.'/../.env')) {
    require __DIR__.'/../install/index.php';
    exit;
}
// ---------------------------------


// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
    require $maintenance;
}

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';

// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
    ->handleRequest(Request::capture());