UninstallCommand.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Encore\Admin\Console;
  3. use Illuminate\Console\Command;
  4. class UninstallCommand extends Command
  5. {
  6. /**
  7. * The console command name.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'admin:uninstall';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = 'Uninstall the admin package';
  18. /**
  19. * Execute the console command.
  20. *
  21. * @return void
  22. */
  23. public function handle()
  24. {
  25. if (!$this->confirm('Are you sure to uninstall laravel-admin?')) {
  26. return;
  27. }
  28. $this->removeFilesAndDirectories();
  29. $this->line('<info>Uninstalling laravel-admin!</info>');
  30. }
  31. /**
  32. * Remove files and directories.
  33. *
  34. * @return void
  35. */
  36. protected function removeFilesAndDirectories()
  37. {
  38. $this->laravel['files']->deleteDirectory(config('admin.directory'));
  39. $this->laravel['files']->deleteDirectory(public_path('vendor/laravel-admin/'));
  40. $this->laravel['files']->delete(config_path('admin.php'));
  41. }
  42. }