/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Filesystem $filesystem, AddonEnvironment $env)
 {
     $this->filesystem = $filesystem;
     $addon_name = $this->argument('addon');
     $this->addon = $env->addon($addon_name);
     // check addon
     if ($this->addon === null) {
         throw new UnexpectedValueException("Addon '{$addon_name}' is not found.");
     }
     $this->currentNamespace = trim($this->addon->phpNamespace(), '\\');
     $this->newNamespace = str_replace('/', '\\', $this->argument('namespace'));
     // check namespace
     if (!$this->validPhpNamespace($this->newNamespace)) {
         throw new UnexpectedValueException("PHP namespace '{$this->newNamespace}' is invalid.");
     }
     // confirm
     $this->line('Addon name: ' . $addon_name);
     $this->line('Addon path: ' . $this->addon->relativePath($this->laravel));
     $this->line('PHP namespace: ' . $this->newNamespace);
     if (!$this->option('force')) {
         if (!$this->confirm('Are you sure? [y/N]', false)) {
             $this->comment('canceled');
             return;
         }
     }
     $this->setAddonNamespaces();
     $this->setComposerNamespace();
     $this->setClassNamespace();
     $this->setConfigNamespaces();
     $this->info('Addon namespace set!');
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Filesystem $filesystem, AddonEnvironment $env)
 {
     $addon_name = $this->argument('addon');
     $addon = $env->addon($addon_name);
     // check addon
     if ($addon === null) {
         throw new UnexpectedValueException(sprintf('Addon "%s" is not found.', $addon_name));
     }
     // confirm
     $this->line('Addon name: ' . $addon_name);
     $this->line('Addon path: ' . $addon->relativePath($this->laravel));
     if (!$this->option('force')) {
         if (!$this->confirm('Are you sure? [y/N]', false)) {
             $this->comment('canceled');
             return;
         }
     }
     // process
     $filesystem->deleteDirectory($addon->path());
     $this->info(sprintf('Addon "%s" removed.', $addon_name));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Filesystem $filesystem, AddonEnvironment $env)
 {
     // make addons/
     $addons_directory = $env->path();
     if (!$filesystem->exists($addons_directory)) {
         $filesystem->makeDirectory($addons_directory);
     }
     $addon_name = $this->argument('addon');
     if (!$addon_name) {
         $addons = $env->addons();
         $this->line('--------');
         foreach ($addons as $addon) {
             $this->dump($addon);
             $this->line('--------');
         }
     } else {
         $addon = $env->addon($addon_name);
         // check addon
         if ($addon === null) {
             throw new UnexpectedValueException(sprintf('Addon "%s" is not found.', $addon_name));
         }
         $this->dump($addon);
     }
 }