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
 /**
  * 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')));
 }
 /**
  * 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.º 6
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);
 }
 /**
  * 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')));
 }
 /**
  * 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()));
 }
Exemplo n.º 11
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.º 12
0
 /**
  * Set a value on the value collection.
  *
  * @param $key
  * @param $value
  */
 public function setValue($key, $value)
 {
     $this->values->put($key, $value);
 }
 /**
  * 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.º 14
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;
 }
Exemplo n.º 15
0
 /**
  * Add a widget to the widget collection.
  *
  * @param WidgetExtension $widget
  */
 public function addWidget(WidgetExtension $widget)
 {
     $this->widgets->put($widget->getSlug(), $widget);
 }