PublishCommand.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Dcat\Admin\Console;
  3. use Illuminate\Console\Command;
  4. class PublishCommand extends Command
  5. {
  6. /**
  7. * The console command name.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'admin:publish
  12. {--force : Overwrite any existing files}
  13. {--lang : Publish language files}
  14. {--assets : Publish assets files}
  15. {--migrations : Publish migrations files}
  16. {--config : Publish configuration files}';
  17. /**
  18. * The console command description.
  19. *
  20. * @var string
  21. */
  22. protected $description = "Re-publish dcat-admin's assets, configuration, language and migration files. If you want overwrite the existing files, you can add the `--force` option";
  23. /**
  24. * Execute the console command.
  25. *
  26. * @return void
  27. */
  28. public function handle()
  29. {
  30. $options = ['--provider' => 'Dcat\Admin\AdminServiceProvider'];
  31. if ($this->option('force')) {
  32. $options['--force'] = true;
  33. }
  34. if ($this->option('lang')) {
  35. $options['--tag'] = 'dcat-admin-lang';
  36. } elseif ($this->option('migrations')) {
  37. $options['--tag'] = 'dcat-admin-migrations';
  38. } elseif ($this->option('assets')) {
  39. $options['--tag'] = 'dcat-admin-assets';
  40. } elseif ($this->option('config')) {
  41. $options['--tag'] = 'dcat-admin-config';
  42. }
  43. $this->call('vendor:publish', $options);
  44. $this->call('view:clear');
  45. }
  46. }