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->routes(function () {
// 1. Agency API (Domain riêng, dùng routes/client.php)
Route::domain('api-agency.test')
// 1. Agency API — domain riêng → chỉ client.php
Route::domain(env('API_AGENCY_URL'))
->middleware(['api', 'json.response'])
->namespace($this->namespace)
->group(base_path('routes/client.php'));
// 2. System API (Dùng cho portal.test/api/..., dùng routes/api.php)
Route::prefix('api')
// 2. System API — bind về APP_URL
Route::domain(env('APP_URL'))
->prefix('api')
->middleware(['api', 'json.response'])
->namespace($this->namespace)
->group(base_path('routes/api.php'));
// 3. Admin Backend routes (DNS Manager)
Route::middleware('web')
// 3. Admin Backend routes
Route::domain(env('APP_URL'))
->middleware('web')
->namespace($this->namespace)
->group(base_path('routes/admin.php'));
// 4. Web routes
Route::middleware('web')
Route::domain(env('APP_URL'))
->middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});