Passed
Push — master ( e1e86f...c6853e )
by Curtis
05:23 queued 11s
created

DropTb   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
A __construct() 0 4 1
1
<?php
2
3
namespace App\Jobs\Tenant;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Support\Facades\DB;
11
use LaravelEnso\Companies\App\Models\Company;
12
use LaravelEnso\Multitenancy\App\Enums\Connections;
13
use LaravelEnso\Multitenancy\App\Services\Tenant;
14
class DropTb implements ShouldQueue
15
{
16
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Jobs\Tenant\DropTb: $id, $relations, $class, $keyBy
Loading history...
17
    private $tenant;
18
    /**
19
     * Create a new job instance.
20
     *
21
     * @return void
22
     */
23
    public function __construct(Company $tenant)
24
    {
25
        //
26
        $this->tenant = $tenant;
27
28
        // $this->queue = 'light';
29
    }
30
31
    /**
32
     * Execute the job.
33
     *
34
     * @return void
35
     */
36
    public function handle()
37
    {
38
        //
39
        Tenant::set($this->tenant);
40
41
        DB::connection(Connections::Tenant)
42
            ->getSchemaBuilder()
43
            ->dropAllTables();
44
    }
45
}
46