| Total Complexity | 5 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class PublishMigrationCommand extends Command |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The console command name. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $name = 'domain:publish-migration'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The console command description. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $description = "Publish a domain's migrations to the application"; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Execute the console command. |
||
| 28 | */ |
||
| 29 | public function handle(): int |
||
| 30 | { |
||
| 31 | $this->components->info('publishing domain migrations...'); |
||
| 32 | |||
| 33 | if ($name = $this->argument('domain')) { |
||
| 34 | $domain = $this->laravel['domains']->findOrFail($name); |
||
| 35 | |||
| 36 | $this->publish($domain); |
||
| 37 | |||
| 38 | return 0; |
||
| 39 | } |
||
| 40 | |||
| 41 | foreach ($this->laravel['domains']->allEnabled() as $domain) { |
||
| 42 | $this->publish($domain); |
||
| 43 | } |
||
| 44 | |||
| 45 | return 0; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Publish migration for the specified domain. |
||
| 50 | * |
||
| 51 | * @param \Salah3id\Domains\Domain $domain |
||
| 52 | */ |
||
| 53 | public function publish($domain) |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Get the console command arguments. |
||
| 63 | * |
||
| 64 | * @return array |
||
| 65 | */ |
||
| 66 | protected function getArguments() |
||
| 73 |