/** * Return the form to create a new disk. * * @param DiskFormBuilder $disk * @param AdapterFormBuilder $form * @param ExtensionCollection $adapters * @param ConfigurationFormBuilder $configuration * @return \Symfony\Component\HttpFoundation\Response */ public function create(DiskFormBuilder $disk, AdapterFormBuilder $form, ExtensionCollection $adapters, ConfigurationFormBuilder $configuration) { $adapter = $adapter = $adapters->get($_GET['adapter']); $form->addForm('disk', $disk->setAdapter($adapter)); $form->addForm('configuration', $configuration->setEntry($adapter->getNamespace())); return $form->render(); }
/** * Execute the console command. * * @param ExtensionManager $manager * @param ExtensionCollection $extensions */ public function fire(ExtensionManager $manager, ExtensionCollection $extensions) { /* @var Extension $extension */ $extension = $extensions->get($this->argument('extension')); $manager->install($extension, $this->option('seed')); $this->info(trans($extension->getName()) . ' installed successfully!'); }
/** * Handle loading the dashboard widgets. * * @param DashboardBuilder $builder * @return array */ public function handle(DashboardBuilder $builder) { $module = $this->modules->active(); $builder->setWidgets(array_map(function (Extension $widget) { return $widget->getProvides(); }, $this->extensions->search($module->getNamespace('widget.*'))->all())); }
/** * Return the form to create a new block. * * @param BlockFormBuilder $block * @param BlockTypeFormBuilder $form * @param ExtensionCollection $blocks * @param ConfigurationFormBuilder $configuration * @return \Symfony\Component\HttpFoundation\Response */ public function create(BlockFormBuilder $block, BlockTypeFormBuilder $form, ExtensionCollection $blocks, ConfigurationFormBuilder $configuration) { $type = $blocks->get($_GET['type']); $form->addForm('block', $block->setType($type)); $form->addForm('configuration', $configuration->setEntry($type->getNamespace())); return $form->render(); }
/** * Make the widget from the parameters. * * @param array $parameters */ public function make(array $parameters) { if (!($widget = $this->widgets->find(array_get($parameters, 'widget')))) { $widget = app()->make(array_get($parameters, 'widget')); } $this->hydrator->hydrate($widget, $parameters); return $widget; }
/** * Create a new entry. * * @param ExtensionCollection $extensions * @param WidgetExtensionFormBuilder|WidgetFormBuilder $form * @param WidgetFormBuilder $widget * @param ConfigurationFormBuilder $configuration * @return \Symfony\Component\HttpFoundation\Response */ public function create(ExtensionCollection $extensions, WidgetExtensionFormBuilder $form, WidgetFormBuilder $widget, ConfigurationFormBuilder $configuration) { /* @var WidgetExtension $extension */ $extension = $extensions->get($this->request->get('widget')); $form->addForm('widget', $widget->setExtension($extension)); $form->addForm('configuration', $configuration->setEntry($extension->getNamespace())); return $form->render(); }
/** * Attempt to authenticate the credentials. * * @param array $credentials * @return bool|UserInterface */ public function authenticate(array $credentials) { $authenticators = $this->extensions->search('anomaly.module.users::authenticator.*'); /* @var AuthenticatorExtensionInterface $authenticator */ foreach ($authenticators as $authenticator) { if ($user = $authenticator->authenticate($credentials) instanceof UserInterface) { return $user; } } return false; }
/** * Return the form for creating a new link. * * @param LinkFormBuilder $link * @param EntryFormBuilder $form * @param LinkRepositoryInterface $links * @param MenuRepositoryInterface $menus * @param ExtensionCollection $extensions * @param $menu * @return \Symfony\Component\HttpFoundation\Response */ public function create(LinkFormBuilder $link, EntryFormBuilder $form, LinkRepositoryInterface $links, MenuRepositoryInterface $menus, ExtensionCollection $extensions, $menu) { /* @var LinkTypeInterface $type */ $type = $extensions->get($_GET['link_type']); if ($parent = $links->find($this->request->get('parent'))) { $link->setParent($parent); } $form->addForm('type', $type->builder()); $form->addForm('link', $link->setType($type)->setMenu($menu = $menus->findBySlug($menu))); $this->breadcrumbs->add($menu->getName(), 'admin/navigation/links/' . $menu->getSlug()); return $form->render(); }
/** * Return the form to create a new disk. * * @param DiskFormBuilder $disk * @param AdapterFormBuilder $form * @param ExtensionCollection $adapters * @param ConfigurationFormBuilder $configuration * @return \Symfony\Component\HttpFoundation\Response */ public function create(DiskFormBuilder $disk, AdapterFormBuilder $form, ExtensionCollection $adapters, ConfigurationFormBuilder $configuration) { $adapter = $adapter = $adapters->get($_GET['adapter']); $form->addForm('disk', $disk->setAdapter($adapter)); $form->addForm('configuration', $configuration->setEntry($adapter->getNamespace())); $form->on('saving_configuration', function () use($form) { /* @var ConfigurationFormBuilder $configuration */ $disk = $form->getChildFormEntry('disk'); $configuration = $form->getChildForm('configuration'); $configuration->setScope($disk->getSlug()); }); return $form->render(); }
/** * Check authorization. * * @param UserInterface $user * @return bool|\Illuminate\Http\RedirectResponse|mixed|string */ public function check(UserInterface $user = null) { $extensions = $this->extensions->search('anomaly.module.users::security_check.*'); /* @var SecurityCheckInterface $extension */ foreach ($extensions as $extension) { /** * If the security check does not return * false then we can assume it passed. */ $response = $extension->check($user); if ($response === true) { continue; } $this->events->fire(new SecurityCheckHasFailed($extension)); return $response; } return true; }
/** * Get the default dashboard. * * @return DashboardInterface */ public function getDefault() { $module = $this->modules->active(); return $this->extensions->search($module->getNamespace('dashboard.*'))->first(); }
/** * Install an extension. * * @param ExtensionCollection $extensions * @param ExtensionManager $manager * @param $extension */ public function extension(ExtensionCollection $extensions, ExtensionManager $manager, $extension) { set_time_limit(5000); $manager->install($extensions->get($extension)); return response()->json(true); }
/** * Handle the command. * * @param InstallAllExtensions $command */ public function handle(InstallAllExtensions $command) { foreach ($this->extensions->all() as $extension) { $this->manager->install($extension, $command->getSeed()); } }