/** * @return mixed */ protected function getManager() { if ($this->getType() == 'plugins') { return Artificer::pluginManager(); } return Artificer::widgetManager(); }
public static function isInstalled() { if (!self::isExtensionDriverReady()) { return false; } $pluginManager = Artificer::pluginManager(); $widgetManager = Artificer::widgetManager(); foreach (Artificer::getCoreExtensions() as $coreExtension) { if (!$pluginManager->isInstalled($coreExtension) && !$widgetManager->isInstalled($coreExtension)) { return false; } } return true; }
protected function installCoreExtensions() { $pluginManager = Artificer::pluginManager(); $widgetManager = Artificer::widgetManager(); // Enable install events Artificer::pluginManager()->boot(); Artificer::widgetManager()->boot(); foreach (Artificer::getCoreExtensions() as $coreExtension) { if (!$pluginManager->isInstalled($coreExtension) && !$widgetManager->isInstalled($coreExtension)) { // Todo: know if its plugin or widget $installed = $pluginManager->installer()->install($coreExtension); if (!$installed) { throw new \Exception("Unable to install Artificer core extension {$coreExtension}"); } } } }
/** * Bootstrap the application events. * * @return void */ public function boot() { if (!$this->isBootable) { return; } $this->addPublishableFiles(); // Wait until app is ready for config to be published if (!$this->isPublished()) { return; } $this->addMiddleware(); $this->providers(config('admin.providers')); $this->aliases(config('admin.aliases')); $this->commands(config('admin.commands')); Artificer::assetManager()->add(config('admin.assets', [])); $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'artificer'); if (InstallServiceProvider::isExtensionDriverReady()) { Artificer::pluginManager()->boot(); Artificer::widgetManager()->boot(); } if (!$this->app->routesAreCached()) { require_once __DIR__ . '/../routes/admin.php'; } }
protected function applyWidgets() { foreach ($this->widgets as $widget) { $widget = Artificer::widgetManager()->get($widget); $widget->assets(Artificer::assetManager()); return $widget->field($this); } return $this; }
/** * @param array|string $widget * @return bool */ protected function addWidget($widget) { return Artificer::widgetManager()->add($this->package, $widget); }