<?php

// Only this entry point and static assets are exposed by the LWS subdomain.
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));
$appRoot = null;
foreach ([dirname(__DIR__, 2).'/home/absences-ua', '/home/absences-ua'] as $candidate) {
    if (is_file($candidate.'/vendor/autoload.php') && is_file($candidate.'/bootstrap/app.php')) {
        $appRoot = $candidate;
        break;
    }
}
if ($appRoot === null) {
    http_response_code(503);
    exit('Service temporairement indisponible.');
}
if (is_file($maintenance = $appRoot.'/storage/framework/maintenance.php')) {
    require $maintenance;
}
require $appRoot.'/vendor/autoload.php';
/** @var Application $app */
$app = require $appRoot.'/bootstrap/app.php';
$app->usePublicPath(__DIR__);
$app->handleRequest(Request::capture());
