DatabaseJob::fire()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace App\Queue\Jobs;
4
5
use App\Models\Tenant;
6
use Illuminate\Support\Facades\Config;
7
use Illuminate\Support\Facades\DB;
8
9
class DatabaseJob extends \Illuminate\Queue\Jobs\DatabaseJob
10
{
11
    public function fire()
12
    {
13
        if ($this->job->tenant_id) {
14
            $tenant = Tenant::findOrFail($this->job->tenant_id);
0 ignored issues
show
Unused Code introduced by
The assignment to $tenant is dead and can be removed.
Loading history...
15
            Config::set('database.connections.tenant.database', 'tenant_'.$this->job->tenant_id);
16
            DB::purge('tenant');
17
        }
18
19
        parent::fire();
20
    }
21
}
22