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


PHP Repository::get方法代码示例

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


在下文中一共展示了Repository::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Retrieves the location from the driver MaxMind and returns a location object.
  *
  * @param string $ip
  *
  * @return Location
  */
 public function get($ip)
 {
     $location = new Location();
     $settings = $this->config->get('location' . $this->instance->getConfigSeparator() . 'drivers.MaxMind.configuration');
     try {
         if ($settings['web_service']) {
             $maxmind = new Client($settings['user_id'], $settings['license_key']);
         } else {
             $path = app_path('database/maxmind/GeoLite2-City.mmdb');
             /*
              * Laravel 5 compatibility
              */
             if ($this->instance->getConfigSeparator() === '.') {
                 $path = base_path('database/maxmind/GeoLite2-City.mmdb');
             }
             $maxmind = new Reader($path);
         }
         $record = $maxmind->city($ip);
         $location->ip = $ip;
         $location->isoCode = $record->country->isoCode;
         $location->countryName = $record->country->name;
         $location->cityName = $record->city->name;
         $location->postalCode = $record->postal->code;
         $location->latitude = $record->location->latitude;
         $location->driver = get_class($this);
     } catch (\Exception $e) {
         $location->error = true;
     }
     return $location;
 }
开发者ID:ktardthong,项目名称:beerhit,代码行数:37,代码来源:MaxMind.php

示例2: can

 /**
  * Determines if a user has certain permission.
  * If user is not logged then checks for role permission.
  *
  * @param $identifier
  * @param null $arg0
  * @param null $arg1
  * @param null $arg2
  * @param null $arg3
  * @param null $arg4
  * @return bool
  */
 public function can($identifier, $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null)
 {
     $ignoreSuper = $this->ignoreSuper;
     $this->ignoreSuper = false;
     $ignoreCallback = $this->ignoreCallback;
     $this->ignoreCallback = false;
     if (!is_null($this->user())) {
         if (!$ignoreSuper) {
             if ($this->user()->can($this->config->get('rbauth::super_permission'))) {
                 return true;
             }
         }
         if (!$ignoreCallback) {
             if (isset($this->rules[$identifier])) {
                 if (!is_null($this->route)) {
                     $resolved = $this->resolveFromRoute($this->route, array($arg0, $arg1, $arg2, $arg3, $arg4));
                     foreach ($resolved as $key => $value) {
                         ${'arg' . $key} = $value;
                     }
                     $this->route = null;
                 }
                 return $this->callCallback($identifier, $arg0, $arg1, $arg2, $arg3, $arg4);
             }
         }
         return $this->user()->can($identifier);
     } else {
         $role = $this->roleProvider->getByName($this->config->get('rbauth::default_role'));
         if ($role) {
             return $role->can($identifier);
         }
     }
     return false;
 }
开发者ID:edvinaskrucas,项目名称:rbauth,代码行数:45,代码来源:RBAuth.php

示例3: get

 /**
  * Get the evaluated contents of the view.
  *
  * @param  string $path
  * @param  array  $data
  *
  * @throws \Exception
  * @return string
  */
 public function get($path, array $data = array())
 {
     ob_start();
     try {
         $smarty = new \Smarty();
         $smarty->caching = $this->config->get('smarty-view::caching');
         $smarty->debugging = $this->config->get('smarty-view::debugging');
         $smarty->cache_lifetime = $this->config->get('smarty-view::cache_lifetime');
         $smarty->compile_check = $this->config->get('smarty-view::compile_check');
         $smarty->error_reporting = $this->config->get('smarty-view::error_reporting');
         if (\App::environment('local')) {
             $smarty->force_compile = true;
         }
         $smarty->setTemplateDir($this->config->get('smarty-view::template_dir'));
         $smarty->setCompileDir($this->config->get('smarty-view::compile_dir'));
         $smarty->setCacheDir($this->config->get('smarty-view::cache_dir'));
         $smarty->registerResource('view', new ViewResource());
         $smarty->addPluginsDir(__DIR__ . '/plugins');
         foreach ((array) $this->config->get('smarty-view::plugins_path', array()) as $pluginPath) {
             $smarty->addPluginsDir($pluginPath);
         }
         foreach ($data as $key => $value) {
             $smarty->assign($key, $value);
         }
         $smarty->display($path);
     } catch (\Exception $e) {
         ob_get_clean();
         throw $e;
     }
     return ltrim(ob_get_clean());
 }
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:40,代码来源:SmartyView.php

示例4: disabled

 /**
  * Return disabled class name when needed.
  *
  * @param string $className
  *
  * @return mixed|string
  */
 public function disabled($className = '')
 {
     if (!$className) {
         $className = $this->config->get('crumbs.disabled_item_class');
     }
     return $this->isDisabled() ? $className : '';
 }
开发者ID:atorscho,项目名称:crumbs,代码行数:14,代码来源:CrumbsItem.php

示例5: getPreparedRules

 /**
  * Get the prepared validation rules.
  *
  * @return array
  */
 protected function getPreparedRules()
 {
     $forbidden = $this->config->get('config.forbidden_usernames');
     $forbidden = implode(',', $forbidden);
     $this->rules['username'] .= '|not_in:' . $forbidden;
     return $this->rules;
 }
开发者ID:phpspider,项目名称:laravel-tricks,代码行数:12,代码来源:RegistrationForm.php

示例6: redirect

 /**
  * Force SSl if it's enabled by the configuration
  *
  * @return bool|\Illuminate\HTTP\RedirectResponse|null
  */
 protected function redirect()
 {
     if ($this->config->get('larapress.settings.ssl')) {
         return $this->helpers->forceSSL();
     }
     return false;
 }
开发者ID:LaraGit,项目名称:larapress,代码行数:12,代码来源:ForceSSLFilter.php

示例7: __construct

 /**
  * @param Config          $config
  * @param DatabaseManager $database
  */
 public function __construct(Config $config, DatabaseManager $database)
 {
     $this->database = $database;
     $this->entities = new EntityCollection();
     $this->entities->setConfig($config->get('auth.multiauth.entities'));
     $this->identifierKey = $config->get('auth.multiauth.identifier_key');
 }
开发者ID:bogardo,项目名称:multiauth,代码行数:11,代码来源:Service.php

示例8: uploadSingleFile

 /**
  * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
  *
  * @return string
  */
 protected function uploadSingleFile($file)
 {
     $filename = uniqid() . '.' . $file->getClientOriginalExtension();
     $targetDirectory = public_path($this->config->get('paxifi.files.uploads_directory'));
     $file->move($targetDirectory, $filename);
     return $this->config->get('app.url') . '/' . basename($targetDirectory) . '/' . $filename;
 }
开发者ID:xintang22,项目名称:Paxifi,代码行数:12,代码来源:FileSystemUploaderProvider.php

示例9: anyUpload

 public function anyUpload(InterfaceFileStorage $userFileStorage, AmqpWrapper $amqpWrapper, Server $server, UploadEntity $uploadEntity)
 {
     /* @var \App\Components\UserFileStorage $userFileStorage */
     $responseVariables = ['uploadStatus' => false, 'storageErrors' => [], 'uploadEntities' => []];
     if ($this->request->isMethod('post') && $this->request->hasFile('file') && $this->request->file('file')->isValid()) {
         $tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp-user-files-to-storage' . DIRECTORY_SEPARATOR;
         $tmpFilePath = $tmpDir . $this->request->file('file')->getClientOriginalName();
         $this->request->file('file')->move($tmpDir, $this->request->file('file')->getClientOriginalName());
         $userFileStorage->setValidationRules($this->config->get('storage.userfile.validation'));
         $newStorageFile = $userFileStorage->addFile($tmpFilePath);
         if ($newStorageFile && !$userFileStorage->hasErrors()) {
             /* @var \SplFileInfo $newStorageFile */
             // AMQP send $newfile, to servers
             foreach ($server->all() as $server) {
                 if (count($server->configs) > 0) {
                     foreach ($server->configs as $config) {
                         // Send server and file info to upload queue task
                         $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $config->auth . '@' . $server->host . '/' . trim($config->path, '\\/')]));
                     }
                 } else {
                     // The server has no configuration
                     $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $server->host]));
                 }
             }
             $responseVariables['uploadStatus'] = true;
         } else {
             $responseVariables['storageErrors'] = $userFileStorage->getErrors();
         }
         if ($this->request->ajax()) {
             return $this->response->json($responseVariables);
         }
     }
     $responseVariables['uploadEntities'] = $uploadEntity->limit(self::UPLOAD_ENTITIES_LIMIT)->orderBy('created_at', 'DESC')->get();
     return $this->view->make('upload.index', $responseVariables);
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:35,代码来源:UploadController.php

示例10: __construct

 public function __construct(Config $config, SessionStore $session)
 {
     if ($config->has('ttwitter::config')) {
         $this->tconfig = $config->get('ttwitter::config');
     } else {
         if ($config->get('ttwitter')) {
             $this->tconfig = $config->get('ttwitter');
         } else {
             throw new Exception('No config found');
         }
     }
     $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
     $this->parent_config = [];
     $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
     $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
     $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
     $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
     if ($session->has('access_token')) {
         $access_token = $session->get('access_token');
         if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
             $this->parent_config['token'] = $access_token['oauth_token'];
             $this->parent_config['secret'] = $access_token['oauth_token_secret'];
         }
     }
     $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
     $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
     $config = array_merge($this->parent_config, $this->tconfig);
     parent::__construct($this->parent_config);
 }
开发者ID:thujohn,项目名称:twitter,代码行数:29,代码来源:Twitter.php

示例11: __construct

 public function __construct(ConfigRepository $config, QueryFormatter $formatter)
 {
     $this->_defer = $config->get('dbprofiler.slow.defer', true);
     $this->_formatter = $formatter;
     $this->_filename = storage_path('/logs/query.' . date('d.m.y') . '.slow.log');
     $this->_time = $config->get('dbprofiler.slow.time', 500);
 }
开发者ID:shenaar,项目名称:dbprofiler,代码行数:7,代码来源:SlowQueryHandler.php

示例12: make

 /**
  * Creates an Response object and executes the magic of the LAPI response layer.
  *
  * @param \Illuminate\Support\Contracts\ArrayableInterface|array $data
  * @param int   $code
  * @param \Illuminate\Support\Contracts\ArrayableInterface|array $headers
  *
  * @return \Illuminate\Http\Response
  */
 public function make($data, $code = 200, array $headers = array())
 {
     $httpHeaderConfig = $this->config->get('lapi::http_header_parameters');
     $headers = array_merge(array($httpHeaderConfig['http_header_contenttype'] => $this->getResponseContentType()), $headers);
     $data = $this->formatData($data);
     return new Response($data, $code, $headers);
 }
开发者ID:kyjan,项目名称:lapi,代码行数:16,代码来源:LapiResponse.php

示例13: __construct

 /**
  * Generate a new instance of the EloquentRouteRepository instance
  *
  * @param  \Leitom\Role\Eloquent\Route 	  $route
  * @param  \Illuminate\Config\repository  $config
  * @return void
  */
 public function __construct(Route $routes, Repository $config)
 {
     $this->routes = $routes;
     $this->config = $config;
     // Set role sync
     $this->roleSync = $this->config->get('role::super.admin.sync');
 }
开发者ID:leitom,项目名称:role,代码行数:14,代码来源:EloquentRouteRepository.php

示例14: __construct

 /**
  * Create an instance of EloquentRoleRepository
  *
  * @param  \Leitom\Role\Eloquent\Role 	  $roles
  * @param  \Illuminate\Config\repository  $config
  * @return void
  */
 public function __construct(Role $roles, Repository $config)
 {
     $this->roles = $roles;
     $this->config = $config;
     // Set the super admin identifier
     $this->superAdminIdentifier = $this->config->get('role::super.admin.id');
 }
开发者ID:leitom,项目名称:role,代码行数:14,代码来源:EloquentRoleRepository.php

示例15: it_should_allow_a_put

 public function it_should_allow_a_put(FakeCacheStore $cache, Config $config)
 {
     $config->get(Argument::any())->shouldBeCalled()->willReturn(10);
     $config->get('forrest.storage.store_forever')->shouldBeCalled()->willReturn(false);
     $cache->put(Argument::any(), Argument::any(), Argument::type('integer'))->shouldBeCalled();
     $this->put('test', 'value');
 }
开发者ID:omniphx,项目名称:forrest,代码行数:7,代码来源:LaravelCacheSpec.php


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