Skip to content

Commit e4cb60a

Browse files
authored
Merge pull request #5 from rgasch/dev
Fixed missing 'use' statement + better log handling for 'strict' issues.
2 parents 3a6be9d + 8ad7cb3 commit e4cb60a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

InstallLaravel.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ function patchAppServiceProviderForStrictMode(string $color, string $noColor): v
523523
$line = $fileLines[$i];
524524
$output[] = $line;
525525
if (!$firstUse && strpos($line, 'use ') === 0) {
526+
$output[] = 'use Illuminate\Database\Connection';
526527
$output[] = 'use Illuminate\Database\Eloquent\Model;';
527528
$output[] = 'use Illuminate\Contracts\Http\Kernel as HttpKernel;';
528529
$output[] = 'use Illuminate\Contracts\Console\Kernel as ConsoleKernel;';
@@ -546,13 +547,13 @@ function patchAppServiceProviderForStrictMode(string $color, string $noColor): v
546547
if (\$this->app->isProduction()) {
547548
Model::handleLazyLoadingViolationUsing(function (\$model, \$relation) {
548549
\$class = get_class(\$model);
549-
info(\"Attempted to lazy load [{\$relation}] on model [{\$class}].\");
550+
Log::warning(\"Attempted to lazy load [{\$relation}] on model [{\$class}].\");
550551
});
551552
}
552553
553554
// Log queries which run for more than 1 second
554555
DB::whenQueryingForLongerThan(1000, function (Connection \$connection) {
555-
Log::warning(\"Database queries exceeded 2 seconds on {\$connection->getName()}\");
556+
Log::warning(\"Database queries exceeded 1 second on {\$connection->getName()}\");
556557
});
557558
558559
// Log slow Commands (5 seconds) or Requests (1 second)

0 commit comments

Comments
 (0)