Conditions | 6 |
Paths | 17 |
Total Lines | 39 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function handle($request, Closure $next) |
||
20 | { |
||
21 | $db = \Session::get('companyId'); |
||
22 | |||
23 | if (! $request->user()) { |
||
24 | return $next($request); |
||
25 | } |
||
26 | |||
27 | $cid = $db; |
||
28 | $company = Company::find($cid); |
||
29 | |||
30 | $tanent = false; |
||
31 | if($company) { |
||
32 | $tanent = true; |
||
33 | } |
||
34 | |||
35 | if (optional($company)->isTenant()) { |
||
36 | Tenant::set($company); |
||
37 | } |
||
38 | |||
39 | MixedConnection::set( |
||
40 | $request->user(), |
||
41 | $tanent |
||
42 | // $request->has('_tenantId') |
||
43 | ); |
||
44 | |||
45 | if ($request->has('_tenantId')) { |
||
46 | $request->request->remove('_tenantId'); |
||
47 | } |
||
48 | |||
49 | $conn = \Session::get('conn'); |
||
50 | $value = \Session::get('db'); |
||
51 | if($conn === 'tenant') { |
||
52 | $key = 'database.connections.tenant.database'; |
||
53 | config([$key => $value]); |
||
54 | $config = json_encode(config('database.connections.'.$conn)); |
||
55 | error_log('*****************************************************'.$config); |
||
56 | } |
||
57 | return $next($request); |
||
58 | } |
||
66 |
This check looks for private methods that have been defined, but are not used inside the class.