Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Outputs/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function getOutputContent(Collection $detectedQueries)
$output = '<script type="text/javascript">';
$output .= "alert('Found the following N+1 queries in this request:\\n\\n";
foreach ($detectedQueries as $detectedQuery) {
$output .= "Model: ".addslashes($detectedQuery['model']). " => Relation: ".addslashes($detectedQuery['relation']);
$output .= "Model: ".addslashes($detectedQuery['model'])." => Relation: ".addslashes($detectedQuery['relation']);
$output .= " - You should add \"with(\'".addslashes($detectedQuery['relation'])."\')\" to eager-load this relation.";
$output .= "\\n";
}
Expand Down
11 changes: 10 additions & 1 deletion src/Outputs/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ protected function getOutputContent(Collection $detectedQueries)
$output = '<script type="text/javascript">';
$output .= "console.warn('Found the following N+1 queries in this request:\\n\\n";
foreach ($detectedQueries as $detectedQuery) {
$output .= "Model: ".addslashes($detectedQuery['model']). " => Relation: ".addslashes($detectedQuery['relation']);
$output .= "Model: ".addslashes($detectedQuery['model'])." => Relation: ".addslashes($detectedQuery['relation']);
$output .= " - You should add \"with(\'".$detectedQuery['relation']."\')\" to eager-load this relation.";
$output .= "\\n\\n";
$output .= "Model: ".addslashes($detectedQuery['model'])."\\n";
$output .= "Relation: ".$detectedQuery['relation']."\\n";
$output .= "Num-Called: ".$detectedQuery['count']."\\n";
$output .= "\\n";
$output .= 'Call-Stack:\\n';

foreach ($detectedQuery['sources'] as $source) {
$output .= "#$source->index $source->name:$source->line\\n";
}
}
$output .= "')";
$output .= '</script>';
Expand Down