當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Repository::set方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Config\Repository::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Repository::set方法的具體用法?PHP Repository::set怎麽用?PHP Repository::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\Config\Repository的用法示例。


在下文中一共展示了Repository::set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fire

 /**
  * @return void
  */
 public function fire()
 {
     if (!$this->isDataSetted) {
         $this->setDataFromConsoling();
     }
     $this->config->set('database', ['fetch' => PDO::FETCH_OBJ, 'default' => $this->data->get('driver'), 'connections' => [], 'redis' => []]);
     switch ($this->data->get('driver')) {
         case 'mysql':
             $this->config->set('database.connections.mysql', ['driver' => 'mysql', 'host' => $this->data->get('database_host'), 'database' => $this->data->get('database'), 'username' => $this->data->get('database_username'), 'password' => $this->data->get('database_password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => $this->data->get('database_prefix'), 'strict' => true, 'engine' => null]);
             break;
         case 'pgsql':
             $this->config->set('database.connections.pgsql', ['driver' => 'pgsql', 'host' => $this->data->get('database_host'), 'database' => $this->data->get('database'), 'username' => $this->data->get('database_username'), 'password' => $this->data->get('database_password'), 'charset' => 'utf8', 'prefix' => $this->data->get('database_prefix'), 'schema' => 'public', 'sslmode' => 'prefer']);
             break;
         case 'sqlite':
             $this->config->set('database.connections.sqlite', ['driver' => 'sqlite', 'database' => $this->container->storagePath() . DIRECTORY_SEPARATOR . 'bootstraps' . DIRECTORY_SEPARATOR . 'database.sqlite', 'prefix' => $this->data->get('database_prefix')]);
             touch($this->container->storagePath() . DIRECTORY_SEPARATOR . 'bootstraps' . DIRECTORY_SEPARATOR . 'database.sqlite');
             break;
     }
     $this->call('migrate', ['--force' => true, '--path' => str_replace(base_path() . DIRECTORY_SEPARATOR, '', database_path('migrations'))]);
     $this->call('passport:keys');
     $this->call('passport:client', ['--password' => true, '--name' => 'Notadd Administrator Client']);
     $setting = $this->container->make(SettingsRepository::class);
     $setting->set('site.name', $this->data->get('website'));
     $setting->set('setting.image.engine', 'webp');
     if ($this->data->get('image_engine', false)) {
     } else {
         $setting->set('setting.image.engine', 'normal');
     }
     $this->createAdministrationUser();
     $this->writingConfiguration();
     $this->call('key:generate');
     $this->info('Notadd Installed!');
 }
開發者ID:notadd,項目名稱:framework,代碼行數:36,代碼來源:InstallCommand.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($tz = $request->header('Time-Zone')) {
         $this->config->set('cachet.timezone', $tz);
     }
     return $next($request);
 }
開發者ID:bashou,項目名稱:Cachet,代碼行數:15,代碼來源:Timezone.php

示例3: loadConfigurationFiles

 /**
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
  * @param \Illuminate\Contracts\Config\Repository                                     $repository
  *
  * @return void
  */
 protected function loadConfigurationFiles(Application $application, RepositoryContract $repository)
 {
     foreach ($this->getConfigurationFiles($application) as $key => $path) {
         $repository->set($key, require $path);
     }
     if ($application->isInstalled()) {
         $database = (require $application->storagePath() . DIRECTORY_SEPARATOR . 'bootstraps' . DIRECTORY_SEPARATOR . 'replace.php');
         $repository->set('database', $database);
     }
 }
開發者ID:notadd,項目名稱:framework,代碼行數:16,代碼來源:LoadConfiguration.php

示例4: loadConfigurationFiles

 /**
  * Load the configuration items from all of the files.
  *
  * @param  \Illuminate\Contracts\Foundation\Application $app
  * @param  \Illuminate\Contracts\Config\Repository      $config
  * @return void
  */
 protected function loadConfigurationFiles(Application $app, \Illuminate\Contracts\Config\Repository $config)
 {
     foreach ($this->getConfigurationFiles($app) as $key => $path) {
         $config->set($key, require $path);
     }
     foreach ($this->getConfigurationFilesYml($app) as $key => $path) {
         $c = Yaml::parse($this->files->get($path));
         $config->set($key, $c);
     }
 }
開發者ID:laradic,項目名稱:config,代碼行數:17,代碼來源:LoadConfiguration.php

示例5: map

 /**
  * Map configuration to allow orchestra to store it in database.
  *
  * @param  string  $name
  * @param  array   $aliases
  *
  * @return bool
  */
 public function map($name, $aliases)
 {
     $memory = $this->memory->make();
     $meta = $memory->get("extension_{$name}", []);
     foreach ($aliases as $current => $default) {
         isset($meta[$current]) && $this->config->set($default, $meta[$current]);
         $meta[$current] = $this->config->get($default);
     }
     $memory->put("extension_{$name}", $meta);
     return true;
 }
開發者ID:jitheshgopan,項目名稱:extension,代碼行數:19,代碼來源:Repository.php

示例6: fire

 /**
  * @return void
  */
 public function fire()
 {
     if (!$this->isDataSetted) {
         $this->setDataFromConsoling();
     }
     $this->config->set('database', ['fetch' => PDO::FETCH_CLASS, 'default' => 'mysql', 'connections' => ['mysql' => ['driver' => 'mysql', 'host' => $this->data->get('host'), 'database' => $this->data->get('database'), 'username' => $this->data->get('username'), 'password' => $this->data->get('password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => $this->data->get('prefix'), 'strict' => true]], 'migrations' => 'migrations', 'redis' => []]);
     $this->call('migrate');
     $this->setting->set('site.title', $this->data->get('title'));
     $this->setting->set('seo.title', $this->data->get('title'));
     $this->createAdministrationUser();
     $this->writingConfiguration();
     $this->comment('Application Installed!');
 }
開發者ID:darrengopower,項目名稱:framework,代碼行數:16,代碼來源:InstallCommand.php

示例7: addNamespaceOverrides

 /**
  * Add namespace overrides to configuration.
  *
  * @param $namespace
  * @param $directory
  */
 public function addNamespaceOverrides($namespace, $directory)
 {
     if (!$this->files->isDirectory($directory)) {
         return;
     }
     /* @var SplFileInfo $file */
     foreach ($this->files->allFiles($directory) as $file) {
         $key = trim(str_replace($directory, '', $file->getPath()) . DIRECTORY_SEPARATOR . $file->getBaseName('.php'), DIRECTORY_SEPARATOR);
         // Normalize key slashes.
         $key = str_replace('\\', '/', $key);
         $this->config->set($namespace . '::' . $key, array_replace($this->config->get($namespace . '::' . $key, []), $this->files->getRequire($file->getPathname())));
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:19,代碼來源:Configurator.php

示例8: loadConfigurationFiles

 protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
 {
     foreach ($this->getConfigurationFiles($app) as $key => $path) {
         $parts = explode(".", $path);
         $ext = array_pop($parts);
         switch ($ext) {
             case 'php':
                 $repository->set($key, require $path);
                 break;
             case 'ini':
                 $repository->set($key, parse_ini_file($path, true));
                 break;
         }
     }
 }
開發者ID:skvn,項目名稱:laraext,代碼行數:15,代碼來源:LoadConfiguration.php

示例9: loadConfigurationFiles

 /**
  * Load the configuration items from all of the files.
  *
  * @param  Application $app
  * @param  Repository  $config
  *
  * @return void
  */
 protected function loadConfigurationFiles(Application $app, Repository $config)
 {
     foreach ($this->getConfigurationFiles($app) as $key => $path) {
         $ext = substr($path, strrpos($path, '.') + 1);
         switch ($ext) {
             case 'php':
                 $config->set($key, require $path);
                 break;
             case 'yml':
             case 'yaml':
                 $config->set($key, $this->parseYamlOrLoadFromCache($path));
                 break;
         }
     }
 }
開發者ID:krom,項目名稱:laravel-yaml-configuration,代碼行數:23,代碼來源:LoadYamlConfiguration.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Obtener las bases de datos
     $bds = BaseDatosCadeco::all();
     $this->output->progressStart(count($bds));
     foreach ($bds as $bd) {
         $this->output->newLine();
         $this->info('Revirtiendo la ultima migracion en ' . $bd->nombre);
         $this->config->set('database.connections.' . $this->argument('connection') . '.database', $bd->nombre);
         $this->call('migrate:rollback', ['--database' => $this->argument('connection')]);
         DB::disconnect($this->argument('connection'));
         $this->output->progressAdvance();
     }
     $this->output->progressFinish();
 }
開發者ID:Grupo-Hermes-Infraestructura,項目名稱:core,代碼行數:20,代碼來源:RollbackOnAllDatabases.php

示例11: loadConfigurationFiles

 protected function loadConfigurationFiles(Application $app, RepositoryContract $config)
 {
     foreach ($this->getConfigurationFiles($app) as $key => $paths) {
         $config->set($key, require $paths[0]);
         if (count($paths) > 1) {
             foreach ($paths as $i => $path) {
                 if ($i === 0) {
                     continue;
                 }
                 $values = (require $paths[$i]);
                 $config->set($key, array_replace_recursive($config->get($key), $values));
             }
         }
     }
 }
開發者ID:KinaMarie,項目名稱:laravel-5-base-app-support,代碼行數:15,代碼來源:LoadConfiguration.php

示例12: registerExtensionHandles

 /**
  * Set the handles to orchestra/extension package config (if available).
  *
  * @param  string  $name
  * @param  array   $options
  *
  * @return void
  */
 protected function registerExtensionHandles($name, array $options)
 {
     $handles = Arr::get($options, 'config.handles');
     if (!is_null($handles)) {
         $this->config->set("orchestra/extension::handles.{$name}", $handles);
     }
 }
開發者ID:jitheshgopan,項目名稱:extension,代碼行數:15,代碼來源:Dispatcher.php

示例13: saveValueFor

 /**
  * Save the given property's value in this handler's
  * configuration
  *
  * @param Property $property
  * @param mixed $valueToBeSaved
  */
 protected function saveValueFor(Property $property, $valueToBeSaved)
 {
     // Change the configuration
     $this->config->set($this->key, $valueToBeSaved);
     // Save the value as a "previous" answer
     self::$previousAnswers[$property->getId()] = $valueToBeSaved;
     // Output what value is being used
     $this->outputStatus($valueToBeSaved, $property->getType(), $property->getId());
 }
開發者ID:aedart,項目名稱:scaffold,代碼行數:16,代碼來源:PropertyHandler.php

示例14: handle

 /**
  * Handle the form.
  *
  * @param ForgotPasswordFormBuilder $builder
  * @param UserRepositoryInterface   $users
  * @param UserPassword              $password
  */
 public function handle(ForgotPasswordFormBuilder $builder, UserRepositoryInterface $users, UserPassword $password, Repository $config)
 {
     $user = $users->findByEmail($builder->getFormValue('email'));
     if ($path = $builder->getFormOption('reset_path')) {
         $config->set('anomaly.module.users::paths.reset', $path);
     }
     $password->forgot($user);
     $password->send($user, $builder->getFormOption('reset_redirect'));
 }
開發者ID:tobz-nz,項目名稱:users-module,代碼行數:16,代碼來源:ForgotPasswordFormHandler.php

示例15: mergeEnv

 /**
  * Merge the items in the given files into the items.
  *
  * @param RepositoryContract $repository
  * @param string             $env
  * @param array              $filesByEnv
  *
  * @return void
  */
 protected function mergeEnv(RepositoryContract $repository, $env, $filesByEnv)
 {
     $ignoreCount = strlen($env) + 1;
     foreach ($filesByEnv as $key => $path) {
         $key = substr($key, $ignoreCount);
         $origin = $repository->get($key);
         $repository->set($key, array_replace_recursive($origin, require $path));
     }
 }
開發者ID:mint-soft-com,項目名稱:xpressengine,代碼行數:18,代碼來源:LoadConfiguration.php


注:本文中的Illuminate\Contracts\Config\Repository::set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。