diff --git a/README.md b/README.md index b6d78a7..f80cab1 100644 --- a/README.md +++ b/README.md @@ -66,31 +66,36 @@ return [ ], /* - * Define the output format that you want to use. Multiple classes are supported + * Define the output format that you want to use. Multiple classes are supported. * Available options are: * * Alert: * Displays an alert on the website * \BeyondCode\QueryDetector\Outputs\Alert::class * - * Debugbar: (make sure you have the barryvdh/laravel-debugbar package installed) - * Writes the N+1 queries into a custom messages collector of Debugbar - * \BeyondCode\QueryDetector\Outputs\Debugbar::class - * - * Log: - * Writes the N+1 queries into the Laravel.log file - * \BeyondCode\QueryDetector\Outputs\Log::class - * * Console: * Writes the N+1 queries into your browsers console log * \BeyondCode\QueryDetector\Outputs\Console::class * + * Clockwork: (make sure you have the itsgoingd/clockwork package installed) + * Writes the N+1 queries warnings to Clockwork log + * \BeyondCode\QueryDetector\Outputs\Clockwork::class + * + * Debugbar: (make sure you have the barryvdh/laravel-debugbar package installed) + * Writes the N+1 queries into a custom messages collector of Debugbar + * \BeyondCode\QueryDetector\Outputs\Debugbar::class + * * JSON: * Writes the N+1 queries into the response body of your JSON responses * \BeyondCode\QueryDetector\Outputs\Json::class + * + * Log: + * Writes the N+1 queries into the Laravel.log file + * \BeyondCode\QueryDetector\Outputs\Log::class */ 'output' => [ - \BeyondCode\QueryDetector\Outputs\Alert::class + \BeyondCode\QueryDetector\Outputs\Log::class, + \BeyondCode\QueryDetector\Outputs\Alert::class, ] ]; diff --git a/config/config.php b/config/config.php index 06de878..b7c63cf 100644 --- a/config/config.php +++ b/config/config.php @@ -22,31 +22,35 @@ ], /* - * Define the output formats that you want to use. + * Define the output format that you want to use. Multiple classes are supported. * Available options are: * * Alert: * Displays an alert on the website * \BeyondCode\QueryDetector\Outputs\Alert::class * - * Debugbar: (make sure you have the barryvdh/laravel-debugbar package installed) - * Writes the N+1 queries into a custom messages collector of Debugbar - * \BeyondCode\QueryDetector\Outputs\Debugbar::class - * - * Log: - * Writes the N+1 queries into the Laravel.log file - * \BeyondCode\QueryDetector\Outputs\Log::class - * * Console: * Writes the N+1 queries into your browsers console log * \BeyondCode\QueryDetector\Outputs\Console::class * + * Clockwork: (make sure you have the itsgoingd/clockwork package installed) + * Writes the N+1 queries warnings to Clockwork log + * \BeyondCode\QueryDetector\Outputs\Clockwork::class + * + * Debugbar: (make sure you have the barryvdh/laravel-debugbar package installed) + * Writes the N+1 queries into a custom messages collector of Debugbar + * \BeyondCode\QueryDetector\Outputs\Debugbar::class + * * JSON: * Writes the N+1 queries into the response body of your JSON responses * \BeyondCode\QueryDetector\Outputs\Json::class + * + * Log: + * Writes the N+1 queries into the Laravel.log file + * \BeyondCode\QueryDetector\Outputs\Log::class */ 'output' => [ - \BeyondCode\QueryDetector\Outputs\Log::class, \BeyondCode\QueryDetector\Outputs\Alert::class, + \BeyondCode\QueryDetector\Outputs\Log::class, ] ]; diff --git a/src/Outputs/Clockwork.php b/src/Outputs/Clockwork.php new file mode 100644 index 0000000..533bcbd --- /dev/null +++ b/src/Outputs/Clockwork.php @@ -0,0 +1,14 @@ +warning("{$detectedQueries->count()} N+1 queries detected:", $detectedQueries->toArray()); + } +}