| Conditions | 6 |
| Paths | 5 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | public function handle() |
||
| 29 | { |
||
| 30 | $tenantId = $this->argument('tenantId'); |
||
| 31 | |||
| 32 | if ($tenantId) { |
||
| 33 | $tenant = Tenant::find($tenantId); |
||
| 34 | if (!$tenant) { |
||
| 35 | throw new RuntimeException('Tenant with ID = '.$tenantId.' does not exist.'); |
||
|
|
|||
| 36 | } |
||
| 37 | |||
| 38 | $this->tenantManager->setTenant($tenant); |
||
| 39 | \DB::purge('tenant'); |
||
| 40 | $this->migrate(); |
||
| 41 | |||
| 42 | return; |
||
| 43 | } |
||
| 44 | |||
| 45 | if (!$tenantId && $this->confirm('Do you wish to run migration for ALL tenants?')) { |
||
| 46 | $tenants = Tenant::all(); |
||
| 47 | |||
| 48 | foreach ($tenants as $tenant) { |
||
| 49 | $this->tenantManager->setTenant($tenant); |
||
| 50 | \DB::purge('tenant'); |
||
| 51 | $this->migrate(); |
||
| 52 | } |
||
| 53 | |||
| 54 | return; |
||
| 55 | } |
||
| 73 |