configureRateLimiting(); $this->routes(function () { // 1. Agency API (Domain riêng, dùng routes/client.php) Route::domain('api-agency.test') ->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') ->middleware(['api', 'json.response']) ->namespace($this->namespace) ->group(base_path('routes/api.php')); // 3. Web & Admin routes Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); }); } /** * Configure the rate limiters for the application. * * @return void */ protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); } }