Files
ecdown 177f122c10
tests / ci (push) Canceled after 0s
added roles and organizations
2026-10-15 20:59:32 -07:00

35 lines
1.2 KiB
PHP

<?php
use App\Http\Middleware\EnsureAdmin;
use App\Http\Middleware\EnsureSubscribed;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'admin' => EnsureAdmin::class,
'subscribed' => EnsureSubscribed::class,
]);
// Stripe posts to the Cashier webhook with no session and no CSRF
// token, so the path is exempted. "stripe" must match
// config('cashier.path'), which CASHIER_PATH can change; keep the two
// in step if the path is ever customized.
$middleware->validateCsrfTokens(except: [
'stripe/*',
]);
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
fn (Request $request) => $request->is('api/*') || $request->expectsJson(),
);
})->create();