/**
  * Get the config.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     /**
      * If images only manually set
      * the allowed mimes.
      */
     if (array_get($config, 'image')) {
         array_set($config, 'mimes', ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'svg']);
     }
     /**
      * If restricting mimes then prepend
      * with a period as Dropzone requires.
      */
     if (isset($config['mimes'])) {
         foreach ($config['mimes'] as &$extension) {
             $extension = '.' . $extension;
         }
     }
     /**
      * Determine the default max upload size.
      */
     if (!array_get($config, 'max')) {
         $post = str_replace('M', '', ini_get('post_max_size'));
         $file = str_replace('M', '', ini_get('upload_max_filesize'));
         array_set($config, 'max', $file > $post ? $post : $file);
     }
     return $config;
 }
 /**
  * Handle the command.
  *
  * @param Repository $config
  * @param Evaluator  $evaluator
  */
 public function handle(Repository $config, Evaluator $evaluator, Translator $translator)
 {
     if (!($fields = $config->get($this->fieldType->getNamespace('config/config')))) {
         $fields = $config->get($this->fieldType->getNamespace('config'), []);
     }
     $fields = $evaluator->evaluate($fields);
     foreach ($fields as $slug => $field) {
         /*
          * Determine the field label.
          */
         $label = $this->fieldType->getNamespace('config.' . $slug . '.label');
         if (!$translator->has($label)) {
             $label = $this->fieldType->getNamespace('config.' . $slug . '.name');
         }
         $field['label'] = array_get($field, 'label', $label);
         /*
          * Determine the instructions.
          */
         $instructions = $this->fieldType->getNamespace('config.' . $slug . '.instructions');
         if ($translator->has($instructions)) {
             $field['instructions'] = $instructions;
         }
         /*
          * Determine the placeholder.
          */
         $placeholder = $this->fieldType->getNamespace('config.' . $slug . '.placeholder');
         if ($translator->has($placeholder)) {
             $field['placeholder'] = $placeholder;
         }
         /*
          * Determine the warning.
          */
         $warning = $this->fieldType->getNamespace('config.' . $slug . '.warning');
         if ($translator->has($warning)) {
             $field['warning'] = $warning;
         }
         /*
          * Set the configuration value.
          */
         $field['value'] = array_get($this->fieldType->getConfig(), $slug);
         // Prefix the slugs.
         $field['field'] = 'config__' . $slug;
         $fields['config__' . $slug] = $field;
         $this->builder->addField($field);
     }
 }
 /**
  * Get the config.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     $timezones = array_map(function ($timezone) {
         return strtolower($timezone);
     }, timezone_identifiers_list());
     // Check for default / erroneous timezone.
     if (($timezone = strtolower(array_get($config, 'timezone'))) && !in_array($timezone, $timezones)) {
         $config['timezone'] = $this->configuration->get('streams::datetime.default_timezone', $this->configuration->get('app.timezone'));
     }
     return $config;
 }
 /**
  * Get the config array.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     /**
      * Get the configuration preset.
      */
     $configuration = config($this->getNamespace('redactor.configurations.' . $this->config('configuration', 'default')));
     /**
      * Set the buttons and plugins from config.
      */
     $config['buttons'] = $this->config('buttons', $configuration['buttons']);
     $config['plugins'] = $this->config('plugins', $configuration['plugins']);
     return $config;
 }
 /**
  * Get the config.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     $post = str_replace('M', '', ini_get('post_max_size'));
     $file = str_replace('M', '', ini_get('upload_max_filesize'));
     $server = $file > $post ? $post : $file;
     if (!($max = array_get($config, 'max'))) {
         $max = $server;
     }
     if ($max > $server) {
         $max = $server;
     }
     array_set($config, 'max', $max);
     return $config;
 }
 /**
  * Get the config array.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     /*
      * Get the configuration values.
      */
     $configuration = config($this->getNamespace('redactor.configurations.' . $this->config('configuration', 'default')));
     $buttons = array_keys(config($this->getNamespace('redactor.buttons')));
     $plugins = array_keys(config($this->getNamespace('redactor.plugins')));
     /*
      * Set the buttons and plugins from config.
      */
     $config['buttons'] = array_intersect((array) $this->config('buttons', $configuration['buttons']), $buttons);
     $config['plugins'] = array_intersect((array) $this->config('plugins', $configuration['plugins']), $plugins);
     return $config;
 }
 /**
  * Update the field type column to the table.
  *
  * @param Blueprint           $table
  * @param AssignmentInterface $assignment
  */
 public function updateColumn(Blueprint $table, AssignmentInterface $assignment)
 {
     // Skip if no column type.
     if (!$this->fieldType->getColumnType()) {
         return;
     }
     // Skip if the column doesn't exists.
     if (!$this->schema->hasColumn($table->getTable(), $this->fieldType->getColumnName())) {
         return;
     }
     /**
      * Update the column to the table.
      *
      * @var Blueprint|Fluent $column
      */
     $column = call_user_func_array([$table, $this->fieldType->getColumnType()], array_filter([$this->fieldType->getColumnName(), $this->fieldType->getColumnLength()]));
     $column->nullable(!$assignment->isTranslatable() ? !$assignment->isRequired() : true)->change();
     if (!str_contains($this->fieldType->getColumnType(), ['text', 'blob'])) {
         $column->default(array_get($this->fieldType->getConfig(), 'default_value'));
     }
     /**
      * Mark the column unique if desired and not translatable.
      * Otherwise, drop the unique index.
      */
     $connection = $this->schema->getConnection();
     $manager = $connection->getDoctrineSchemaManager();
     $doctrine = $manager->listTableDetails($connection->getTablePrefix() . $table->getTable());
     // The unique index name.
     $unique = md5('unique_' . $this->fieldType->getColumnName());
     /**
      * If the assignment is unique and not translatable
      * and the table does not already have the given the
      * given table index then go ahead and add it.
      */
     if ($assignment->isUnique() && !$assignment->isTranslatable() && !$doctrine->hasIndex($unique)) {
         $table->unique($this->fieldType->getColumnName(), $unique);
     }
     /**
      * If the assignment is NOT unique and not translatable
      * and the table DOES have the given table index
      * then we need to remove.
      */
     if (!$assignment->isUnique() && !$assignment->isTranslatable() && $doctrine->hasIndex($unique)) {
         $column->dropIndex(md5('unique_' . $this->fieldType->getColumnName()));
     }
 }
 /**
  * Get the config.
  *
  * @return array
  */
 public function getConfig()
 {
     $config = parent::getConfig();
     array_set($config, 'folders', (array) $this->config('folders', []));
     return $config;
 }