Docs have pretty straightforward explanation of how to add routes from another file applying grouping by prefix/route name/domain: https://laravel.com/docs/12.x/routing#routing-customization
Have you tried it?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
in my web.php file I have currently the following block of code for admin.myapp.com. The number of entries is pretty low cause I started the project today:
Route::domain(config('domains.admin'))->group(function () {
Route::middleware([AdminAuth::class])->group(function () {
Route::get('/', [DashboardController::class, 'index'])->name('admin.dashboard');
});
Route::get('/login', [AdminLoginController::class, 'index'])->name('admin.login');
});
Since I know from now that the app will be quite big, I prefer to split the routes and put all admin related routes into a separated file admin.php.
Now I have to register the route. I simply wanted to register the route file admin.php with inside the block
Route::domain(config('domains.admin'))->group(function () {
});
But it looks like I can remove the domain condition and add it in the bootstrap/app.php.
Could you please clarify for me it a bit?
Thanks, Simon
Please or to participate in this conversation.