Skip to content

Commit f9cf0b6

Browse files
committed
Laravel 10
1 parent be8f988 commit f9cf0b6

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

.php-cs-fixer.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"description": "A dev tool to log all queries for laravel application.",
44
"type": "library",
55
"require": {
6-
"laravel/framework": "^9.0"
6+
"laravel/framework": "^9.0|^10.0"
77
},
88
"require-dev": {
9-
"friendsofphp/php-cs-fixer": "^3.0"
9+
"laravel/pint": "^1.5",
10+
"brainmaestro/composer-git-hooks": "dev-master"
1011
},
1112
"autoload": {
1213
"psr-4": {
@@ -28,11 +29,9 @@
2829
},
2930
"hooks": {
3031
"pre-commit": [
31-
"composer test",
32-
"composer fix-style"
32+
"composer check-style"
3333
],
3434
"pre-push": [
35-
"composer test",
3635
"composer check-style"
3736
]
3837
}
@@ -47,8 +46,8 @@
4746
"cghooks update"
4847
],
4948
"cghooks": "vendor/bin/cghooks",
50-
"check-style": "php-cs-fixer fix --using-cache=no --diff --dry-run --ansi",
51-
"fix-style": "php-cs-fixer fix --using-cache=no --ansi",
49+
"check-style": "vendor/bin/pint --test",
50+
"fix-style": "vendor/bin/pint",
5251
"test": "vendor/bin/phpunit --colors=always"
5352
},
5453
"scripts-descriptions": {

src/ServiceProvider.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Overtrue\LaravelQueryLogger;
1313

1414
use Illuminate\Database\Events\QueryExecuted;
15-
use Illuminate\Support\Facades\DB;
1615
use Illuminate\Support\Facades\Log;
1716
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
1817

@@ -23,13 +22,13 @@ class ServiceProvider extends LaravelServiceProvider
2322
*/
2423
public function boot()
2524
{
26-
if (!$this->app['config']->get('logging.query.enabled', false)) {
25+
if (! $this->app['config']->get('logging.query.enabled', false)) {
2726
return;
2827
}
2928

3029
$trigger = $this->app['config']->get('logging.query.trigger');
3130

32-
if (!empty($trigger) && !$this->requestHasTrigger($trigger)) {
31+
if (! empty($trigger) && ! $this->requestHasTrigger($trigger)) {
3332
return;
3433
}
3534

@@ -50,7 +49,7 @@ public function boot()
5049
}
5150
Log::channel(config('logging.query.channel', config('logging.default')))
5251
->debug(sprintf('[%s] [%s] %s | %s: %s', $query->connection->getDatabaseName(), $duration, $realSql,
53-
request()->method(), request()->getRequestUri()));
52+
request()->method(), request()->getRequestUri()));
5453
});
5554
}
5655

@@ -62,8 +61,7 @@ public function register()
6261
}
6362

6463
/**
65-
* @param string $trigger
66-
*
64+
* @param string $trigger
6765
* @return bool
6866
*/
6967
public function requestHasTrigger($trigger)
@@ -75,7 +73,6 @@ public function requestHasTrigger($trigger)
7573
* Format duration.
7674
*
7775
* @param float $seconds
78-
*
7976
* @return string
8077
*/
8178
private function formatDuration($seconds)

0 commit comments

Comments
 (0)