Skip to content

Commit 4753017

Browse files
committed
Expanded the console log warning to have the same level of details as the laravel.log
1 parent d790bcf commit 4753017

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Outputs/Console.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ protected function getOutputContent(Collection $detectedQueries)
2727
$output = '<script type="text/javascript">';
2828
$output .= "console.warn('Found the following N+1 queries in this request:\\n\\n";
2929
foreach ($detectedQueries as $detectedQuery) {
30-
$output .= "Model: ".addslashes($detectedQuery['model']). " => Relation: ".addslashes($detectedQuery['relation']);
31-
$output .= " - You should add \"with(\'".$detectedQuery['relation']."\')\" to eager-load this relation.";
30+
$output .= "Model: " . addslashes($detectedQuery['model']) . " => Relation: " . addslashes($detectedQuery['relation']);
31+
$output .= " - You should add \"with(\'" . $detectedQuery['relation'] . "\')\" to eager-load this relation.";
32+
$output .= "\\n\\n";
33+
$output .= "Model: " . addslashes($detectedQuery['model']) . "\\n";
34+
$output .= "Relation: " . $detectedQuery['relation'] . "\\n";
35+
$output .= "Num-Called: " . $detectedQuery['count'] . "\\n";
3236
$output .= "\\n";
37+
$output .= 'Call-Stack:\\n';
38+
39+
foreach ($detectedQuery['sources'] as $source) {
40+
$output .= "#$source->index $source->name:$source->line\\n";
41+
}
3342
}
3443
$output .= "')";
3544
$output .= '</script>';

0 commit comments

Comments
 (0)