Exemplo n.º 1
0
 /**
  * Handle the command.
  *
  * @return \Anomaly\NavigationModule\Link\LinkCollection|mixed|null
  */
 public function handle()
 {
     if (!$this->menu) {
         $this->menu = $this->dispatch(new GetMenu($this->options->get('menu')));
     }
     if ($this->menu) {
         $links = $this->menu->getLinks();
     } else {
         $links = $this->options->get('links');
     }
     if (!$links) {
         return null;
     }
     if ($root = $this->options->get('root')) {
         if ($link = $this->dispatch(new GetParentLink($root, $links))) {
             $this->options->put('parent', $link);
         }
     }
     // Remove restricted for security purposes.
     $this->dispatch(new RemoveRestrictedLinks($links));
     // Set the relationships manually.
     $this->dispatch(new SetParentRelations($links));
     $this->dispatch(new SetChildrenRelations($links));
     // Flag appropriate links.
     $this->dispatch(new SetCurrentLink($links));
     $this->dispatch(new SetActiveLinks($links));
     return $links;
 }
 /**
  * Handle the command.
  *
  * @param Repository      $config
  * @param ThemeCollection $themes
  */
 public function handle(Repository $config, ThemeCollection $themes)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     foreach ($config->get($theme->getNamespace('variables'), []) as $key => $value) {
         $this->variables->put($key, $value);
     }
 }
 /**
  * Handle the command.
  *
  * @param Dispatcher      $events
  * @param Repository      $config
  * @param ThemeCollection $themes
  */
 public function handle(Dispatcher $events, Repository $config, ThemeCollection $themes)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     foreach ($config->get($theme->getNamespace('variables'), []) as $key => $value) {
         $this->variables->put($key, $value);
     }
     $events->fire(new ThemeVariablesHaveLoaded($this->variables));
 }
Exemplo n.º 4
0
 /**
  * Filters an asset just before it's dumped.
  *
  * @param AssetInterface $asset
  */
 public function filterDump(AssetInterface $asset)
 {
     $this->dispatch(new LoadThemeVariables($variables = new Collection()));
     $compiler = new Compiler();
     if ($dir = $asset->getSourceDirectory()) {
         $compiler->addImportPath($dir);
     }
     $compiler->setVariables($variables->all());
     $asset->setContent($this->parser->parse($compiler->compile($asset->getContent())));
 }
Exemplo n.º 5
0
 /**
  * Handle the command.
  */
 public function handle()
 {
     $this->data->put('ADMIN_USERNAME', $this->command->ask('Enter the desired username for the admin user', env('ADMIN_USERNAME', 'admin')));
     $this->data->put('ADMIN_EMAIL', $this->command->ask('Enter the desired email for the admin user', env('ADMIN_EMAIL')));
     // Validate email.
     if (!filter_var($this->data->get('ADMIN_EMAIL'), FILTER_VALIDATE_EMAIL)) {
         $this->command->error('You must provide a valid email for the admin.');
         exit;
     }
     $this->data->put('ADMIN_PASSWORD', $this->command->ask('Enter the desired password for the admin user', env('ADMIN_PASSWORD')));
 }
Exemplo n.º 6
0
 /**
  * Filters an asset just before it's dumped.
  *
  * @param AssetInterface $asset
  */
 public function filterDump(AssetInterface $asset)
 {
     $compiler = new \lessc();
     $this->dispatch(new LoadThemeVariables($variables = new Collection()));
     $compiler->setVariables($variables->all());
     if ($dir = $asset->getSourceDirectory()) {
         $compiler->importDir = $dir;
     }
     foreach ($this->loadPaths as $loadPath) {
         $compiler->addImportDir($loadPath);
     }
     $asset->setContent($compiler->parse($this->parser->parse($asset->getContent())));
 }
 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  * @param ActionResponder $responder
  */
 public function handle(ResponseFactory $response, ActionResponder $responder)
 {
     $data = new Collection();
     if ($action = $this->builder->getActiveFormAction()) {
         $responder->setFormResponse($this->builder, $action);
         $original = $this->builder->getFormResponse();
         if ($original instanceof RedirectResponse) {
             $data->put('redirect', $original->getTargetUrl());
         }
     }
     $data->put('success', !$this->builder->hasFormErrors());
     $data->put('errors', $this->builder->getFormErrors()->toArray());
     $this->builder->setFormResponse($response = $response->json($data));
 }
Exemplo n.º 8
0
 /**
  * Handle the command.
  *
  * @param SettingRepositoryInterface $settings
  * @param ThemeCollection            $themes
  * @param Repository                 $config
  */
 public function handle(SettingRepositoryInterface $settings, ThemeCollection $themes, Repository $config)
 {
     if (!($theme = $themes->current())) {
         return;
     }
     if (!($fields = $config->get($theme->getNamespace('settings/settings')))) {
         $fields = $config->get($theme->getNamespace('settings'));
     }
     if (!$fields) {
         return;
     }
     foreach (array_keys($fields) as $field) {
         $this->variables->put($field, $settings->get($theme->getNamespace($field), array_get($fields, $field . '.config.default_value')));
     }
 }
 /**
  * Put a breadcrumb into the collection.
  *
  * @param string $key
  * @param string $value
  */
 public function put($key, $value)
 {
     if (!starts_with($value, 'http')) {
         $value = url($value);
     }
     parent::put($key, $value);
 }
 /**
  * Put a breadcrumb into the collection.
  *
  * @param string $key
  * @param string $value
  */
 public function put($key, $value = null)
 {
     if (!$value) {
         $value = url()->current();
     }
     if (!starts_with($value, 'http')) {
         $value = url($value);
     }
     parent::put($key, $value);
 }
Exemplo n.º 11
0
 /**
  * Handle the command.
  */
 public function handle()
 {
     $this->data->put('DB_DRIVER', $this->command->askWithCompletion('What database driver would you like to use? [mysql, pgsql, sqlite, sqlsrv]', ['mysql', 'pgsql', 'sqlite', 'sqlsrv'], env('DB_DRIVER', 'mysql')));
     $this->data->put('DB_HOST', $this->command->ask('What is the hostname of your database?', env('DB_HOST', 'localhost')));
     $this->data->put('DB_DATABASE', $this->command->ask('What is the name of your database?', env('DB_DATABASE')));
     $this->data->put('DB_USERNAME', $this->command->ask('Enter the username for your database connection', env('DB_USERNAME', 'root')));
     $this->data->put('DB_PASSWORD', $this->command->ask('Enter the password for your database connection', env('DB_PASSWORD')));
 }
Exemplo n.º 12
0
 /**
  * Execute the console command.
  */
 public function fire(Dispatcher $events, Application $application, AddonManager $manager)
 {
     $this->dispatch(new ConfirmLicense($this));
     $data = new Collection();
     $this->dispatch(new SetStreamsData($data));
     $this->dispatch(new SetDatabaseData($data, $this));
     $this->dispatch(new SetApplicationData($data, $this));
     $this->dispatch(new SetAdminData($data, $this));
     $this->dispatch(new SetOtherData($data, $this));
     $this->dispatch(new WriteEnvironmentFile($data->all()));
     $this->dispatch(new ReloadEnvironmentFile());
     $this->dispatch(new ConfigureDatabase());
     $this->dispatch(new SetDatabasePrefix());
     $this->dispatch(new LocateApplication());
     $installers = new InstallerCollection();
     $this->dispatch(new LoadCoreInstallers($installers));
     $this->dispatch(new LoadApplicationInstallers($installers));
     $this->dispatch(new LoadModuleInstallers($installers));
     $this->dispatch(new LoadExtensionInstallers($installers));
     $this->dispatch(new RunInstallers($installers, $this));
     $this->call('env:set', ['line' => 'INSTALLED=true']);
     $this->dispatch(new ReloadEnvironmentFile());
     $installers->add(new Installer('streams::installer.running_migrations', function (Kernel $console) {
         $console->call('migrate', ['--force' => true, '--no-addons' => true]);
     }));
     $manager->register();
     // Register all of our addons.
     $events->fire(new StreamsHasInstalled($installers));
     $this->info('Running post installation tasks.');
     $this->dispatch(new LoadModuleSeeders($installers));
     $this->dispatch(new LoadExtensionSeeders($installers));
     $installers->add(new Installer('streams::installer.running_seeds', function (Kernel $console) {
         $console->call('db:seed', ['--force' => true]);
     }));
     $this->dispatch(new RunInstallers($installers, $this));
 }
Exemplo n.º 13
0
 /**
  * Get a value from the value collection.
  *
  * @param      $key
  * @param null $default
  * @return mixed
  */
 public function getValue($key, $default = null)
 {
     return $this->values->get($key, $default);
 }
 /**
  * Return a config value.
  *
  * @param      $key
  * @param null $default
  * @return mixed
  */
 public function config($key, $default = null)
 {
     return $this->config->get($key, $default);
 }
 /**
  * Handle the command.
  */
 public function handle()
 {
     $this->data->put('APPLICATION_NAME', $this->command->ask('Enter the name of your application', env('APPLICATION_NAME', 'Default')));
     $this->data->put('APPLICATION_REFERENCE', $this->command->ask('Enter the reference slug for your application', env('APPLICATION_REFERENCE', 'default')));
     $this->data->put('APPLICATION_DOMAIN', $this->command->ask('Enter the primary domain for your application', env('APPLICATION_DOMAIN', 'localhost')));
 }
Exemplo n.º 16
0
 /**
  * Add a widget to the widget collection.
  *
  * @param WidgetExtension $widget
  */
 public function addWidget(WidgetExtension $widget)
 {
     $this->widgets->put($widget->getSlug(), $widget);
 }
Exemplo n.º 17
0
 /**
  * Handle the command.
  */
 public function handle()
 {
     $this->data->put('APP_ENV', 'local');
     $this->data->put('INSTALLED', 'false');
     $this->data->put('APP_KEY', str_random(32));
 }
Exemplo n.º 18
0
 /**
  * Handle the command.
  *
  * @param Repository $config
  */
 public function handle(Repository $config)
 {
     $this->data->put('LOCALE', $this->command->askWithCompletion('Enter the default locale', array_keys($config->get('streams::locales.supported')), env('APPLICATION_LOCALE', 'en')));
     $this->data->put('TIMEZONE', $this->command->askWithCompletion('Enter the default timezone', timezone_identifiers_list(), env('APPLICATION_TIMEZONE', 'UTC')));
     return $this->data;
 }
 /**
  * Install the system.
  *
  * @param array $parameters
  * @return bool
  */
 public function install(array $parameters)
 {
     $data = new Collection();
     $this->dispatch(new SetStreamsData($data));
     $data->put('DB_DRIVER', $parameters['database_driver']);
     $data->put('DB_HOST', $parameters['database_host']);
     $data->put('DB_DATABASE', $parameters['database_name']);
     $data->put('DB_USERNAME', $parameters['database_username']);
     $data->put('DB_PASSWORD', $parameters['database_password']);
     $data->put('APPLICATION_NAME', $parameters['application_name']);
     $data->put('APPLICATION_DOMAIN', $parameters['application_domain']);
     $data->put('APPLICATION_REFERENCE', $parameters['application_reference']);
     $data->put('ADMIN_THEME', config('streams::themes.admin'));
     $data->put('STANDARD_THEME', config('streams::themes.standard'));
     $data->put('LOCALE', $parameters['application_locale']);
     $data->put('APP_TIMEZONE', $parameters['application_timezone']);
     $data->put('ADMIN_USERNAME', $parameters['admin_username']);
     $data->put('ADMIN_EMAIL', $parameters['admin_email']);
     $data->put('ADMIN_PASSWORD', $parameters['admin_password']);
     $this->dispatch(new WriteEnvironmentFile($data->all()));
 }
 /**
  * Handle the command.
  *
  * @param Factory $view
  * @return null|string
  */
 public function handle(Factory $view)
 {
     $menu = $this->dispatch(new GetMenu($this->options->get('menu')));
     $links = $this->dispatch(new GetLinks($this->options, $menu));
     return $view->make($this->options->get('view', 'anomaly.module.navigation::links'), ['menu' => $menu, 'links' => $links, 'options' => $this->options])->render();
 }