1 | <?php |
||||
2 | |||||
3 | namespace App\Service; |
||||
4 | |||||
5 | use Illuminate\Support\Facades\DB; |
||||
6 | use LaravelEnso\Multitenancy\Enums\Connections; |
||||
0 ignored issues
–
show
|
|||||
7 | |||||
8 | class MixedConnection |
||||
9 | { |
||||
10 | public static function set($user, $tenant) |
||||
0 ignored issues
–
show
The parameter
$user is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
11 | { |
||||
12 | if ($tenant) { |
||||
13 | self::connection(Connections::Tenant); |
||||
14 | } else { |
||||
15 | self::connection('mysql'); |
||||
16 | } |
||||
17 | // This is test for tenant db |
||||
18 | self::connection(Connections::Tenant); |
||||
19 | |||||
20 | // $key = 'database.default'; |
||||
21 | // $value = Connections::Tenant; |
||||
22 | // config([$key => $value]); |
||||
23 | |||||
24 | DB::purge(Connections::Tenant); |
||||
25 | |||||
26 | DB::reconnect(Connections::Tenant); |
||||
27 | } |
||||
28 | |||||
29 | private static function connection($connection) |
||||
30 | { |
||||
31 | $key = 'database.connections.'.Connections::Tenant.'.database'; |
||||
32 | $value = config("database.connections.{$connection}.database"); |
||||
33 | error_log($key.'=>'.$value); |
||||
34 | config([$key => $value]); |
||||
35 | } |
||||
36 | } |
||||
37 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths