/** * Create a extension record. * * @param Extension $extension * @return bool */ public function create(Extension $extension) { $instance = $this->model->newInstance(); $instance->namespace = $extension->getNamespace(); $instance->installed = false; $instance->enabled = false; return $instance->save(); }
/** * Return the status wrapped in a label. * * @return string */ public function statusLabel() { if ($this->object->isEnabled()) { return '<span class="label label-success">' . trans('streams::addon.enabled') . '</span>'; } if ($this->object->isInstalled()) { return '<span class="label label-warning">' . trans('streams::addon.disabled') . '</span>'; } }
/** * Handle the command. * * @param Kernel $console * @param Dispatcher $events * @param ExtensionRepositoryInterface $extensions * @return bool */ public function handle(Kernel $console, Dispatcher $events, ExtensionRepositoryInterface $extensions) { $this->extension->fire('uninstalling'); $options = ['--addon' => $this->extension->getNamespace()]; $console->call('migrate:reset', $options); $console->call('streams:destroy', ['namespace' => $this->extension->getSlug()]); $console->call('streams:cleanup'); $extensions->uninstall($this->extension); $this->extension->fire('uninstalled'); $events->fire(new ExtensionWasUninstalled($this->extension)); return true; }
/** * Handle the command. * * @param InstallExtension|Kernel $console * @param AddonManager $manager * @param Dispatcher $dispatcher * @param ExtensionRepositoryInterface $extensions * @return bool */ public function handle(Kernel $console, AddonManager $manager, Dispatcher $dispatcher, ExtensionRepositoryInterface $extensions) { $this->extension->fire('installing'); $options = ['--addon' => $this->extension->getNamespace(), '--force' => true]; $console->call('migrate:refresh', $options); $extensions->install($this->extension); $manager->register(); if ($this->seed) { $console->call('db:seed', $options); } $this->extension->fire('installed'); $dispatcher->fire(new ExtensionWasInstalled($this->extension)); return true; }
/** * Set the extension flags from a state object. * * @param Extension $extension * @param $state */ protected function setFlags(Extension $extension, $state) { $extension->setEnabled($state->enabled); $extension->setInstalled($state->installed); }