environment('local')) { // 콘솔/큐 등 non-HTTP 컨텍스트 보호 if (function_exists('request') && request() && request()->is('api/*')) { DB::enableQueryLog(); } } } /** * Bootstrap any application services. */ public function boot(): void { // Builder::macro('debug', function($debug = null) { if (is_null($debug) && app()->environment('local')) { $debug = true; } if ($debug) { \DB::enableQueryLog(); } return $this; }); } }