/** * Detect the active module and setup our * environment with it. */ public function handle() { /** * In order to detect we MUST have a route * and we MUST have a namespace in the * streams::addon action parameter. * * @var Route $route */ $route = $this->request->route(); /* @var Module $module */ if ($route && ($module = $this->modules->get(array_get($route->getAction(), 'streams::addon')))) { $module->setActive(true); } if (!$module && $this->request->segment(1) == 'admin' && ($module = $this->modules->findBySlug($this->request->segment(2)))) { $module->setActive(true); } if (!$module) { return; } $this->container->make('view')->addNamespace('module', $module->getPath('resources/views')); $this->container->make('translator')->addNamespace('module', $module->getPath('resources/lang')); $this->asset->addPath('module', $module->getPath('resources')); $this->image->addPath('module', $module->getPath('resources')); }
/** * Handle the event. */ public function handle() { if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) { $this->session->set(__CLASS__ . 'warned', true); $this->messages->error('streams::message.delete_installer'); } }
/** * Execute the console command. * * @param ModuleManager $manager * @param ModuleCollection $modules */ public function fire(ModuleManager $manager, ModuleCollection $modules) { /* @var Module $module */ $module = $modules->get($this->argument('module')); $manager->uninstall($module); $this->info(trans($module->getName()) . ' uninstalled successfully!'); }
/** * Seed a module. * * @param ModuleCollection $modules * @param ModuleManager $manager * @param $module */ public function seed(ModuleCollection $modules, Kernel $console, $module) { set_time_limit(5000); $module = $modules->get($module); $console->call('db:seed', ['--force' => true, '--addon' => $module->getNamespace()]); return response()->json(true); }