当前位置: 首页>>代码示例>>PHP>>正文


PHP Config\Repository类代码示例

本文整理汇总了PHP中Illuminate\Contracts\Config\Repository的典型用法代码示例。如果您正苦于以下问题:PHP Repository类的具体用法?PHP Repository怎么用?PHP Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Repository类的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 the command.
  *
  * @param ModuleCollection $modules
  * @param Decorator        $decorator
  * @param Repository       $config
  * @param Container        $container
  * @param Request          $request
  * @param Search           $search
  * @return LengthAwarePaginator
  */
 public function handle(ModuleCollection $modules, Decorator $decorator, Repository $config, Container $container, Request $request, Search $search)
 {
     /* @var Query $query */
     $query = $search->index($this->criteria->option('index', 'default'));
     $constraint = $this->criteria->option('in');
     if (!empty($constraint) && is_string($constraint)) {
         $query = $query->search('stream', $constraint, ['required' => true]);
     }
     if (!empty($constraint) && is_array($constraint)) {
         /* @var Module $module */
         foreach ($modules->withConfig('search') as $module) {
             foreach ($config->get($module->getNamespace('search')) as $model => $definition) {
                 /* @var EntryInterface $model */
                 $model = $container->make($model);
                 $stream = $model->getStreamNamespace() . '.' . $model->getStreamSlug();
                 if (!in_array($stream, $constraint)) {
                     $query = $query->search('stream', $stream, ['required' => false, 'prohibited' => true]);
                 }
             }
         }
     }
     foreach ($this->criteria->getOperations() as $operation) {
         $query = call_user_func_array([$query, $operation['name']], $operation['arguments']);
     }
     $page = $request->get('page', 1);
     $perPage = $this->criteria->option('paginate', $this->criteria->option('limit', 15));
     $query->limit($perPage, ($page - 1) * $perPage);
     $collection = new SearchCollection(array_map(function ($result) use($decorator) {
         return $decorator->decorate(new SearchItem($result));
     }, $query->get()));
     return (new LengthAwarePaginator($collection, $query->count(), $perPage, $page))->setPath($request->path())->appends($request->all());
 }
开发者ID:Wol,项目名称:search-module,代码行数:43,代码来源:GetSearchResults.php

示例3: __construct

 /**
  * @param \Maknz\Slack\Client $client
  * @param Repository          $config
  */
 public function __construct(Client $client, Repository $config)
 {
     $this->config = $config->get('server-monitor.notifications.slack');
     $client->setDefaultUsername($this->config['username']);
     $client->setDefaultIcon($this->config['icon']);
     $this->client = $client;
 }
开发者ID:ericmakesstuff,项目名称:laravel-server-monitor,代码行数:11,代码来源:Slack.php

示例4: registerMenu

 public static function registerMenu(Dispatcher $events, Repository $config)
 {
     $events->listen(BuildingMenu::class, function (BuildingMenu $event) use($config) {
         $menu = $config->get('adminlte.menu');
         call_user_func_array([$event->menu, 'add'], $menu);
     });
 }
开发者ID:jeroennoten,项目名称:laravel-adminlte,代码行数:7,代码来源:ServiceProvider.php

示例5: createManager

 /**
  * @param Container        $container
  * @param ConfigRepository $config
  */
 protected function createManager(Container $container, ConfigRepository $config)
 {
     $fileManager = $container->make(FileManager::class);
     $imageManager = new ImageManager($fileManager);
     $this->configureManager($imageManager, $container, $config->get('imagemanager', []));
     return $imageManager;
 }
开发者ID:nordsoftware,项目名称:lumen-image-manager,代码行数:11,代码来源:ImageManagerServiceProvider.php

示例6: __construct

 public function __construct(Connection $connection, RepositoryContract $config)
 {
     $dbconfig = $config->get('database.connections.' . $connection->getName());
     $this->dsn = static::parseDSN($dbconfig);
     $this->username = $dbconfig['username'];
     $this->password = $dbconfig['password'];
 }
开发者ID:recca0120,项目名称:laravel-support,代码行数:7,代码来源:Backup.php

示例7: map

 /**
  * Map additional routes.
  *
  * @param Router     $router
  * @param Repository $config
  */
 public function map(Router $router, Repository $config)
 {
     $tag = $config->get('anomaly.module.posts::paths.tag');
     $module = $config->get('anomaly.module.posts::paths.module');
     $category = $config->get('anomaly.module.posts::paths.category');
     $permalink = $config->get('anomaly.module.posts::paths.route');
     /**
      * Map the RSS methods.
      */
     $router->any("{$module}/rss/category/{category}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@category', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss/tag/{tag}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@tag', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@recent', 'streams::addon' => 'anomaly.module.posts']);
     /**
      * Map other public routes.
      * Mind the order. Routes are
      * handled first come first serve.
      */
     $router->any("{$module}/{type}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TypesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any($module, ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/preview/{id}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@preview', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$tag}/{tag}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TagsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$category}/{category}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\CategoriesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/archive/{year}/{month?}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\ArchiveController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$permalink}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@view', 'streams::addon' => 'anomaly.module.posts']);
 }
开发者ID:jacksun101,项目名称:posts-module,代码行数:31,代码来源:PostsModuleServiceProvider.php

示例8: guess

 /**
  * Guess the assignment names.
  *
  * @param Migration $migration
  */
 public function guess(Migration $migration)
 {
     /**
      * If we don't have any addon then
      * we can't automate anything.
      *
      * @var Addon $addon
      */
     if (!($addon = $migration->getAddon())) {
         return;
     }
     $stream = $migration->getStream();
     $stream = $this->streams->findBySlugAndNamespace(array_get($stream, 'slug'), array_get($stream, 'namespace'));
     if (!$stream) {
         return;
     }
     $locale = $this->config->get('app.fallback_locale');
     $assignments = $migration->getAssignments();
     foreach ($assignments as &$assignment) {
         foreach (['label', 'warning', 'instructions', 'placeholder'] as $key) {
             if (is_null(array_get($assignment, $locale . '.' . $key))) {
                 $assignment = array_add($assignment, $locale . '.' . $key, $addon->getNamespace('field.' . array_get($assignment, 'field') . '.' . $key . '.' . $stream->getSlug()));
             }
         }
     }
     $migration->setAssignments($assignments);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:32,代码来源:TranslationGuesser.php

示例9: symbol

 /**
  * Return the currency symbol.
  *
  * @param null $currency
  * @return string
  */
 public function symbol($currency = null)
 {
     if (!$currency) {
         $currency = $this->config->get('streams::currencies.default');
     }
     return $this->config->get('streams::currencies.supported.' . strtoupper($currency) . '.symbol');
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:13,代码来源:Currency.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->config->get('app.debug', false)) {
         return $next($request);
     }
     if (!$request instanceof Request) {
         return $next($request);
     }
     $route = $request->route();
     if (!$route instanceof Route) {
         return $next($request);
     }
     $class = explode('@', $route->getActionName())[0];
     if (!is_subclass_of($class, HalApiControllerContract::class)) {
         return $next($request);
     }
     /** @var HalApiControllerContract $class */
     $cache = $class::getCache($this->cacheFactory);
     if ($request->isMethodSafe()) {
         $key = $this->generateKey($cache, $request);
         return $cache->persist($key, function () use($next, $request) {
             return $next($request);
         });
     }
     $cache->purge();
     foreach ($class::getRelatedCaches($this->cacheFactory) as $relatedCache) {
         $relatedCache->purge();
     }
     return $next($request);
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:37,代码来源:HalApiCacheMiddleware.php

示例11: tagLinks

 /**
  * Return the tag links.
  *
  * @param array $attributes
  * @return string
  */
 public function tagLinks(array $attributes = [])
 {
     array_set($attributes, 'class', array_get($attributes, 'class', 'label label-default'));
     return array_map(function ($label) use($attributes) {
         return $this->html->link(implode('/', [$this->config->get('anomaly.module.posts::paths.module'), $this->config->get('anomaly.module.posts::paths.tag'), $label]), $label, $attributes);
     }, (array) $this->object->getTags());
 }
开发者ID:jacksun101,项目名称:posts-module,代码行数:13,代码来源:PostPresenter.php

示例12: guess

 /**
  * Guess the sections title.
  *
  * @param ControlPanelBuilder $builder
  */
 public function guess(ControlPanelBuilder $builder)
 {
     $sections = $builder->getSections();
     foreach ($sections as &$section) {
         // If title is set then skip it.
         if (isset($section['title'])) {
             continue;
         }
         $module = $this->modules->active();
         $title = $module->getNamespace('section.' . $section['slug'] . '.title');
         if (!isset($section['title']) && $this->translator->has($title)) {
             $section['title'] = $title;
         }
         $title = $module->getNamespace('addon.section.' . $section['slug']);
         if (!isset($section['title']) && $this->translator->has($title)) {
             $section['title'] = $title;
         }
         if (!isset($section['title']) && $this->config->get('streams::system.lazy_translations')) {
             $section['title'] = ucwords($this->string->humanize($section['slug']));
         }
         if (!isset($section['title'])) {
             $section['title'] = $title;
         }
     }
     $builder->setSections($sections);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:31,代码来源:TitleGuesser.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return void|mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$this->app->isDownForMaintenance()) {
         return $next($request);
     }
     if ($request->segment(1) == 'admin') {
         return $next($request);
     }
     if (in_array($request->getClientIp(), $this->config->get('streams::maintenance.ip_whitelist', []))) {
         return $next($request);
     }
     /* @var UserInterface $user */
     $user = $this->guard->user();
     if ($user && $user->isAdmin()) {
         return $next($request);
     }
     if ($user && $this->authorizer->authorize('streams::maintenance.access')) {
         return $next($request);
     }
     if (!$user && $this->config->get('streams::maintenance.auth')) {
         /* @var Response|null $response */
         $response = $this->guard->onceBasic();
         if (!$response) {
             return $next($request);
         }
         $response->setContent(view('streams::errors.401'));
         return $response;
     }
     abort(503);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:37,代码来源:CheckForMaintenanceMode.php

示例14: setWidth

 /**
  * Set Browser Width
  * @param int $width
  */
 public function setWidth($width)
 {
     if (is_null($width)) {
         $width = $this->config->get('screeenly.core.screenshot_width');
     }
     return $this->width = $width;
 }
开发者ID:MehmetNuri,项目名称:screeenly,代码行数:11,代码来源:AbstractClient.php

示例15: handle

 /**
  * Say it loud.
  *
  * @param  Request  $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     /* @var \Illuminate\Http\Response $response */
     $response = $next($request);
     $response->headers->set('X-Streams-Distribution', $this->config->get('streams::distribution.name') . '-' . $this->config->get('streams::distribution.version'));
     return $response;
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:14,代码来源:PoweredBy.php


注:本文中的Illuminate\Contracts\Config\Repository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。