1 | <?php |
||||
2 | |||||
3 | namespace App\Traits; |
||||
4 | |||||
5 | use Illuminate\Support\Facades\App; |
||||
6 | use Illuminate\Support\Facades\Auth; |
||||
7 | |||||
8 | trait TenantConnectionResolver |
||||
9 | { |
||||
10 | public function getConnectionName() |
||||
11 | { |
||||
12 | if (! App::runningUnitTests() && Auth::check()) { |
||||
13 | $user = \Auth::user(); |
||||
14 | $role_id = $user->role_id; |
||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||
15 | if ($user->isAdmin()) { |
||||
0 ignored issues
–
show
The method
isAdmin() does not exist on Illuminate\Contracts\Auth\Authenticatable . It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
16 | return env('DB_DATABASE', 'genealogy'); //'enso'); |
||||
17 | } |
||||
18 | if (session()->get('db')) { |
||||
19 | return 'tenantdb'; |
||||
20 | } |
||||
21 | } |
||||
22 | |||||
23 | return $this->connection; |
||||
24 | } |
||||
25 | } |
||||
26 |