1 | <?php |
||
2 | |||
3 | namespace App\Jobs\Tenant; |
||
4 | |||
5 | use App\Models\Tenant as Tenants; |
||
6 | use Illuminate\Bus\Queueable; |
||
7 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
8 | use Illuminate\Foundation\Bus\Dispatchable; |
||
9 | use Illuminate\Queue\InteractsWithQueue; |
||
10 | use Illuminate\Queue\SerializesModels; |
||
11 | use LaravelEnso\Companies\Models\Company; |
||
12 | |||
13 | // use LaravelEnso\Multitenancy\Traits\TenantResolver; |
||
14 | |||
15 | class CreateDB implements ShouldQueue |
||
16 | { |
||
17 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
18 | |||
19 | /** |
||
20 | * Create a new job instance. |
||
21 | * |
||
22 | * @return void |
||
23 | */ |
||
24 | public function __construct(private readonly Company $tenant) |
||
25 | { |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Execute the job. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | public function handle() |
||
34 | { |
||
35 | Tenants::create([ |
||
36 | 'id' => $this->tenant->id, |
||
37 | ]); |
||
38 | |||
39 | // |
||
40 | // Tenant::set($this->tenant); |
||
41 | // DB::statement('CREATE DATABASE '.$this->tenantDatabase()); |
||
42 | } |
||
43 | } |
||
44 |