Issues (364)

app/Traits/ConnectionTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Traits;
4
5
use LaravelEnso\Multitenancy\Enums\Connections;
0 ignored issues
show
The type LaravelEnso\Multitenancy\Enums\Connections was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
trait ConnectionTrait
8
{
9
    public function setConnection($conn = 'mysql', $db = 'genealogy')//'enso')
10
    {
11
        if ($conn === Connections::Tenant) {
12
            $key = 'database.connections.tenant.database';
13
            config([$key => $db]);
14
        }
15
        \Session::put('conn', $conn);
16
        \Session::put('db', $db);
17
    }
18
19
    public function getConnection()
20
    {
21
        $conn = \Session::get('conn');
22
        $db = \Session::get('db');
23
        if ($conn === 'tenant') {
24
            $key = 'database.connections.tenant.database';
25
            $value = $db;
26
            config([$key => $value]);
27
        }
28
29
        return $conn;
30
    }
31
32
    public function getDB()
33
    {
34
        return \Session::get('db');
35
    }
36
}
37