Skip to content

Commit 5a9481d

Browse files
committed
wip
1 parent f85705e commit 5a9481d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
The Laravel N+1 query detector helps you increase your application's performance by reducing the number of queries it executed.
99
This package will monitor your queries while you develop your application and notify you when you should add eager loading (N+1 queries).
10-
10+
11+
![Example alert](https://beyondco.de/github/n+1/alert.png)
1112

1213
## Installation
1314

src/Outputs/Alert.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ protected function getOutputContent(Collection $detectedQueries)
3232
$output = '<script type="text/javascript">';
3333
$output .= "alert('Found the following N+1 queries in this request:\\n\\n";
3434
foreach ($detectedQueries as $detectedQuery) {
35-
$output .= "Model: ".addslashes($detectedQuery['model']). " => Relation: ".addslashes($detectedQuery['relation'])."\\n";
35+
$output .= "Model: ".addslashes($detectedQuery['model']). " => Relation: ".addslashes($detectedQuery['relation']);
36+
$output .= " - You should add \"with(\'".$detectedQuery['relation']."\')\" to eager-load this relation.";
37+
$output .= "\\n";
3638
}
3739
$output .= "')";
3840
$output .= '</script>';

0 commit comments

Comments
 (0)