withRouting( web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', then: function () { require base_path('routes/install.php'); }, ) ->withMiddleware(function (Middleware $middleware): void { TrustProxies::at('*'); $middleware->redirectGuestsTo(function (Request $request) { if ($request->is('portal', 'portal/*')) { return route('portal.login'); } return route('login'); }); $middleware->alias([ 'admin' => EnsureAdmin::class, 'driver' => EnsureDriver::class, 'dsgvo' => EnsureDsgvoInformed::class, 'installer.guard' => InstallerGuard::class, 'owntracks' => AuthenticateOwntracks::class, 'portal' => EnsureCustomer::class, ]); $middleware->prependToGroup('web', RedirectToInstaller::class); $middleware->group('installer', [ TrustProxies::class, InstallerGuard::class, EncryptCookies::class, AddQueuedCookiesToResponse::class, StartSession::class, ShareErrorsFromSession::class, ValidateCsrfToken::class, ]); }) ->withSchedule(function (Schedule $schedule): void { $schedule->command('jobs:retention-delete')->daily()->at('03:00'); $schedule->command('schneespur:update-check')->daily()->at('04:17') ->runInBackground() ->appendOutputTo(storage_path('logs/schneespur-update.log')); $schedule->command('queue:work', ['--stop-when-empty'])->everyMinute()->withoutOverlapping(); $schedule->call(fn () => cache()->put('cron.last_run', now()))->everyMinute(); }) ->withExceptions(function (Exceptions $exceptions): void { // })->create();