本文整理匯總了PHP中Illuminate\Contracts\Config\Repository::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Repository::get方法的具體用法?PHP Repository::get怎麽用?PHP Repository::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Contracts\Config\Repository
的用法示例。
在下文中一共展示了Repository::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: 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');
}
示例3: normalize
/**
* Normalize the assignments input.
*
* @param Migration $migration
*/
public function normalize(Migration $migration)
{
$locale = $this->config->get('app.fallback_locale');
$stream = $migration->getStream();
$assignments = $migration->getAssignments();
foreach ($assignments as $field => &$assignment) {
/*
* If the assignment is a simple string
* then the assignment is the field slug.
*/
if (is_string($assignment)) {
$assignment = ['field' => $assignment];
}
/*
* Generally the field will be the
* array key. Make sure we have one.
*/
if (!isset($assignment['field'])) {
$assignment['field'] = $field;
}
/*
* If any of the translatable items exist
* in the base array then move them up into
* the translation array.
*/
foreach (['label', 'warning', 'instructions', 'placeholder'] as $key) {
if ($value = array_pull($assignment, $key)) {
$assignment = array_add($assignment, $locale . '.' . $key, $value);
}
}
}
$migration->setAssignments($assignments);
}
示例4: normalize
/**
* Normalize the fields input.
*
* @param Migration $migration
*/
public function normalize(Migration $migration)
{
$locale = $this->config->get('app.fallback_locale');
$fields = $migration->getFields();
foreach ($fields as $slug => &$field) {
/*
* If the field is a simple string then
* the $slug is used as is and the field
* must be the field type.
*/
if (is_string($field)) {
$field = ['type' => $field];
}
if (!isset($field['type'])) {
throw new \Exception("The [type] parameter must be defined in fields.");
}
$field['slug'] = array_get($field, 'slug', $slug);
$field['namespace'] = array_get($field, 'namespace', $migration->contextualNamespace());
/*
* If any of the translatable items exist
* in the base array then move them up into
* the translation array.
*/
foreach (['name', 'instructions', 'placeholder', 'warning'] as $key) {
if ($value = array_pull($field, $key)) {
$field = array_add($field, $locale . '.' . $key, $value);
}
}
}
$migration->setFields($fields);
}
示例5: menu
public function menu($items)
{
if (!is_array($items)) {
$items = $this->config->get($items, array());
}
return $this->view->make('partials/menu', compact('items'));
}
示例6: start
/**
* Start processes
*/
protected function start()
{
foreach ($this->config->get('gitter.rooms') as $key => $id) {
shell_exec('nohup php artisan gitter:listen ' . $key . ' > /dev/null 2>&1 &');
$this->line('Starting ' . $key . ' => ' . $id . ' listener.');
}
}
示例7: 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;
}
示例8: 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;
}
示例9: resolve
/**
* @param $name
*
* @return Sidebar
*/
public function resolve($name)
{
$duration = $this->config->get('sidebar.cache.duration');
return $this->cache->remember(CacheKey::get($name), $duration, function () use($name) {
return $this->resolver->resolve($name);
});
}
示例10: 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']);
}
示例11: 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);
}
示例12: __construct
/**
* Constructor
*
* @param Repository $config
*/
public function __construct(Repository $config)
{
$this->config = $config;
$this->mediaTypes = $this->config->get('files.media_types', ['audio' => ['audio/aac', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/wav', 'audio/webm'], 'document' => ['text/plain', 'application/pdf', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], 'image' => ['image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/svg+xml'], 'video' => ['video/mp4', 'video/ogg', 'video/webm']]);
$this->modelTypes = $this->config->get('files.model_types', ['audio' => 'Kenarkose\\Files\\Media\\Audio', 'document' => 'Kenarkose\\Files\\Media\\Document', 'image' => 'Kenarkose\\Files\\Media\\Image', 'video' => 'Kenarkose\\Files\\Media\\Video']);
$this->defaultMediaModel = $this->config->get('files.media_model', 'Kenarkose\\Files\\Media\\Media');
}
示例13: 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());
}
示例14: getDefaultProjectHook
/**
* Retrieve the default project hook.
*
* @return string
*/
protected function getDefaultProjectHook()
{
// Get default project handle.
$default = $this->config->get(self::CONFIG_DEFAULT);
// Return project hook value.
return $this->config->get(sprintf(self::CONFIG_PROJECT, $default));
}
示例15: 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);
}