refactor: configure all route domains using environment variables.

This commit is contained in:
pbao9
2026-03-16 14:21:04 +07:00
parent c2e90696b6
commit b5c81cf23c
+10 -7
View File
@@ -38,25 +38,28 @@ class RouteServiceProvider extends ServiceProvider
$this->configureRateLimiting(); $this->configureRateLimiting();
$this->routes(function () { $this->routes(function () {
// 1. Agency API (Domain riêng, dùng routes/client.php) // 1. Agency API — domain riêng → chỉ client.php
Route::domain('api-agency.test') Route::domain(env('API_AGENCY_URL'))
->middleware(['api', 'json.response']) ->middleware(['api', 'json.response'])
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/client.php')); ->group(base_path('routes/client.php'));
// 2. System API (Dùng cho portal.test/api/..., dùng routes/api.php) // 2. System API — bind về APP_URL
Route::prefix('api') Route::domain(env('APP_URL'))
->prefix('api')
->middleware(['api', 'json.response']) ->middleware(['api', 'json.response'])
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/api.php')); ->group(base_path('routes/api.php'));
// 3. Admin Backend routes (DNS Manager) // 3. Admin Backend routes
Route::middleware('web') Route::domain(env('APP_URL'))
->middleware('web')
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/admin.php')); ->group(base_path('routes/admin.php'));
// 4. Web routes // 4. Web routes
Route::middleware('web') Route::domain(env('APP_URL'))
->middleware('web')
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/web.php')); ->group(base_path('routes/web.php'));
}); });