/**
  * Handle the command.
  *
  * @param Kernel     $console
  * @param Dispatcher $events
  */
 public function handle(Kernel $console, Dispatcher $events, ModuleRepositoryInterface $modules)
 {
     $this->module->fire('uninstalling');
     $options = ['--addon' => $this->module->getNamespace()];
     $console->call('migrate:reset', $options);
     $console->call('streams:destroy', ['namespace' => $this->module->getSlug()]);
     $console->call('streams:cleanup');
     $modules->uninstall($this->module);
     $this->module->fire('uninstalled');
     $events->fire(new ModuleWasUninstalled($this->module));
 }
Ejemplo n.º 2
0
 /**
  * Handle the command.
  *
  * @param Kernel                    $console
  * @param AddonManager              $manager
  * @param Dispatcher                $dispatcher
  * @param ModuleRepositoryInterface $modules
  * @return bool
  */
 public function handle(Kernel $console, AddonManager $manager, Dispatcher $dispatcher, ModuleRepositoryInterface $modules)
 {
     $this->module->fire('installing');
     $options = ['--addon' => $this->module->getNamespace(), '--force' => true];
     $console->call('migrate:refresh', $options);
     $modules->install($this->module);
     $manager->register();
     if ($this->seed) {
         $console->call('db:seed', $options);
     }
     $this->module->fire('installed');
     $dispatcher->fire(new ModuleWasInstalled($this->module));
     return true;
 }
 /**
  * Create a module record.
  *
  * @param Module $module
  * @return bool
  */
 public function create(Module $module)
 {
     $instance = $this->model->newInstance();
     $instance->namespace = $module->getNamespace();
     $instance->installed = false;
     $instance->enabled = false;
     return $instance->save();
 }
Ejemplo n.º 4
0
 /**
  * Get the override view path.
  *
  * @param  $view
  * @return null|string
  */
 public function getOverloadPath(View $view)
 {
     /**
      * We can only overload namespaced
      * views right now.
      */
     if (!str_contains($view->getName(), '::')) {
         return null;
     }
     /**
      * Split the view into it's
      * namespace and path.
      */
     list($namespace, $path) = explode('::', $view->getName());
     $path = str_replace('.', '/', $path);
     /**
      * If the module is shorthand
      * then check to see if we have
      * an active module to use for it.
      */
     if ($namespace === 'module' && $this->module) {
         $namespace = $this->module->getNamespace();
     }
     /**
      * If the view is already in
      * the theme then skip it.
      */
     if ($namespace == 'theme' || str_is('*.theme.*', $namespace)) {
         return null;
     }
     /**
      * If the view is a streams view then
      * it's real easy to guess what the
      * override path should be.
      */
     if ($namespace == 'streams') {
         $path = $this->theme->getNamespace('streams/' . $path);
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      */
     if ($addon = $this->addons->get($namespace)) {
         $path = $this->theme->getNamespace("addons/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      *
      * @deprecated since v3.0.0
      */
     if ($addon) {
         $path = $this->theme->getNamespace("addon/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     return null;
 }
Ejemplo n.º 5
0
 /**
  * Handle the command.
  *
  * Add a default Module route, language entries etc per Module
  *
  */
 public function handle()
 {
     \Artisan::call('db:seed', ['--addon' => $this->module->getNamespace(), '--force' => true]);
 }