withRouting( web: [ __DIR__ . '/../routes/web.php', __DIR__ . '/../routes/auth.php', __DIR__ . '/../routes/admin.php', ], commands: __DIR__ . '/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { $middleware ->redirectGuestsTo(function (Request $request) { if ($request->routeIs('admin.*')) { return route('admin.auth.login.index'); } return route('auth.login.index'); }) ->redirectUsersTo(function (Request $request) { if ($request->routeIs('admin.*')) { return route(name: 'admin.dashboard.index'); } return route(name: 'index'); }); }) ->withExceptions(function (Exceptions $exceptions): void { // })->create();