1 | <?php |
||
2 | |||
3 | namespace BeyondCode\QueryDetector\Outputs; |
||
4 | |||
5 | use Illuminate\Support\Collection; |
||
6 | use Symfony\Component\HttpFoundation\Response; |
||
7 | |||
8 | use Barryvdh\Debugbar\Facade as LaravelDebugbar; |
||
0 ignored issues
–
show
|
|||
9 | use DebugBar\DataCollector\MessagesCollector; |
||
0 ignored issues
–
show
The type
DebugBar\DataCollector\MessagesCollector was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | |||
11 | class Debugbar implements Output |
||
12 | { |
||
13 | protected $collector; |
||
14 | |||
15 | public function boot() |
||
16 | { |
||
17 | $this->collector = new MessagesCollector('N+1 Queries'); |
||
18 | |||
19 | if (!LaravelDebugbar::hasCollector($this->collector->getName())) { |
||
20 | LaravelDebugbar::addCollector($this->collector); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | public function output(Collection $detectedQueries, Response $response) |
||
25 | { |
||
26 | foreach ($detectedQueries as $detectedQuery) { |
||
27 | $this->collector->addMessage(sprintf('Model: %s => Relation: %s - You should add `with(%s)` to eager-load this relation.', |
||
28 | $detectedQuery['model'], |
||
29 | $detectedQuery['relation'], |
||
30 | $detectedQuery['relation'] |
||
31 | )); |
||
32 | } |
||
33 | } |
||
34 | } |
||
35 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths