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


PHP Config::has方法代码示例

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


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

示例1: get

 /**
  * Get the specified configuration value.
  *
  * @param  string  $key      Name of the key
  * @param  mixed   $default  Default value
  * @param  bool    $dbLookup If false, do not access the database table
  * @return mixed
  */
 public static function get($key, $default = null, $dbLookup = true)
 {
     if (installed() and $dbLookup) {
         $dbChecked = Cache::has(self::CACHE_IN_DB_PREFIX . $key);
         if ($dbChecked) {
             $inDb = Cache::get(self::CACHE_IN_DB_PREFIX . $key);
             if ($inDb) {
                 return Cache::get(self::CACHE_VALUES_PREFIX . $key);
             }
         } else {
             $result = DB::table('config')->whereName($key)->first();
             if (is_null($result)) {
                 Cache::put(self::CACHE_IN_DB_PREFIX . $key, false, self::CACHE_TIME);
             } else {
                 Cache::put(self::CACHE_IN_DB_PREFIX . $key, true, self::CACHE_TIME);
                 Cache::put(self::CACHE_VALUES_PREFIX . $key, $result->value, self::CACHE_TIME);
                 return $result->value;
             }
         }
     }
     if ((strpos($key, '.') !== false or strpos($key, '::') !== false) and LaravelConfig::has($key)) {
         return LaravelConfig::get($key, $default);
     }
     return $default;
 }
开发者ID:exelv1,项目名称:Contentify,代码行数:33,代码来源:Config.php

示例2:

 function __construct()
 {
     // Get default locale string in laravel project
     // and set it as default dictionary
     $locale_dict = Config::has('app.locale') ? Config::get('app.locale') : 'en';
     $this->setDictionary($locale_dict);
 }
开发者ID:arandilopez,项目名称:laravel-profane,代码行数:7,代码来源:ProfaneValidator.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $section = $this->argument('section');
     if (!empty($section)) {
         if (!Config::has($section)) {
             $this->error($section . ' does not exist in your configuration.');
             return;
         }
         // If the requested string is a string, and not something that can be displayed in a table, then just print
         // it out in the console.
         $config = Config::get($section);
         if (!is_array($config)) {
             $this->line('<comment>' . $config . '</comment>');
             return;
         }
         $configs = [$section => $config];
     } else {
         $configs = Config::all();
         ksort($configs);
     }
     foreach ($configs as $section => $config) {
         $depth = $this->getConfigDepth($config);
         $tree = $this->generateTree($config, $depth);
         $this->line('<info>Configuration:</info> <comment>' . $section . '</comment>');
         $this->table([], $tree, 'default');
     }
 }
开发者ID:erunion,项目名称:laravel-examine-config,代码行数:32,代码来源:ExamineConfigCommand.php

示例4: __construct

 public function __construct()
 {
     $_conf = array('DOMPDF_TEMP_DIR', 'DOMPDF_UNICODE_ENABLED', 'DOMPDF_PDF_BACKEND', 'DOMPDF_DEFAULT_MEDIA_TYPE', 'DOMPDF_DEFAULT_PAPER_SIZE', 'DOMPDF_DEFAULT_FONT', 'DOMPDF_DPI', 'DOMPDF_ENABLE_PHP', 'DOMPDF_ENABLE_REMOTE', 'DOMPDF_ENABLE_CSS_FLOAT', 'DOMPDF_ENABLE_JAVASCRIPT', 'DEBUGPNG', 'DEBUGKEEPTEMP', 'DEBUGCSS', 'DEBUG_LAYOUT', 'DEBUG_LAYOUT_LINES', 'DEBUG_LAYOUT_BLOCKS', 'DEBUG_LAYOUT_INLINE', 'DOMPDF_FONT_HEIGHT_RATIO', 'DEBUG_LAYOUT_PADDINGBOX', 'DOMPDF_ENABLE_HTML5PARSER', 'DOMPDF_ENABLE_FONTSUBSETTING', 'DOMPDF_ADMIN_USERNAME', 'DOMPDF_ADMIN_PASSWORD');
     foreach ($_conf as $conf) {
         if ((Config::has('pdf::' . $conf) || Config::get('pdf::' . $conf)) && !defined($conf)) {
             define($conf, Config::get('pdf::' . $conf));
         }
     }
     require_once 'dompdf/dompdf_config.inc.php';
     $this->dompdf = new \DOMPDF();
 }
开发者ID:allan2012,项目名称:laraspiked,代码行数:11,代码来源:Pdf.php

示例5: activeUser

 /**
  * Get the active user.
  *
  * @return int User ID
  * @throws \Exception
  */
 protected function activeUser()
 {
     if (!Config::has('culpa.users.active_user')) {
         return Auth::check() ? Auth::user()->id : null;
     }
     $fn = Config::get('culpa.users.active_user');
     if (!is_callable($fn)) {
         throw new \Exception('culpa.users.active_user should be a closure');
     }
     return $fn();
 }
开发者ID:nstapelbroek,项目名称:culpa,代码行数:17,代码来源:BlameableObserver.php

示例6: __construct

 /**
  * Grab variables from config
  *
  * @param Document $document
  *
  * @return \Adamgoose\PrismicIo\Model
  */
 public function __construct(Document $document = null)
 {
     if (Config::has('prismic.endpoint') && !isset($this->endpoint)) {
         $this->endpoint = Config::get('prismic.endpoint');
     }
     if (Config::has('prismic.token') && !isset($this->token)) {
         $this->token = Config::get('prismic.token');
     }
     if ($document instanceof Document) {
         $this->document = $document;
     }
 }
开发者ID:mrudtf,项目名称:prismoquent,代码行数:19,代码来源:Model.php

示例7: register

 public function register()
 {
     /*--------------------------------------------------------------------------
       | Bind in IOC
       |--------------------------------------------------------------------------*/
     $this->app->bindShared('igaster.themes', function () {
         return new Themes();
     });
     /*--------------------------------------------------------------------------
       | Is package enabled?
       |--------------------------------------------------------------------------*/
     if (!Config::get('themes.enabled', true)) {
         return;
     }
     /*--------------------------------------------------------------------------
       | Extend FileViewFinder
       |--------------------------------------------------------------------------*/
     $this->app->bindShared('view.finder', function ($app) {
         $paths = $app['config']['view.paths'];
         return new \igaster\laravelTheme\themeViewFinder($app['files'], $paths);
     });
     /*--------------------------------------------------------------------------
       | Initialize Themes
       |--------------------------------------------------------------------------*/
     $Themes = $this->app->make('igaster.themes');
     /*--------------------------------------------------------------------------
       |   Load Themes from theme.php configuration file
       |--------------------------------------------------------------------------*/
     if (Config::has('themes') && !empty(Config::get('themes'))) {
         foreach (Config::get('themes.themes') as $themeName => $options) {
             $assetPath = null;
             $viewsPath = null;
             $extends = null;
             if (is_array($options)) {
                 if (array_key_exists('asset-path', $options)) {
                     $assetPath = $options['asset-path'];
                 }
                 if (array_key_exists('views-path', $options)) {
                     $viewsPath = $options['views-path'];
                 }
                 if (array_key_exists('extends', $options)) {
                     $extends = $options['extends'];
                 }
             } else {
                 $themeName = $options;
             }
             $Themes->add(new Theme($themeName, $assetPath, $viewsPath), $extends);
         }
         if (!$Themes->activeTheme) {
             $Themes->set(Config::get('themes.active'));
         }
     }
 }
开发者ID:jitheshgopan,项目名称:laravel-theme,代码行数:53,代码来源:themeServiceProvider.php

示例8: __call

 public function __call($method, $parameters)
 {
     $class_name = class_basename($this);
     #i: Convert array to dot notation
     $config = implode('.', ['relations', $class_name, $method]);
     #i: Relation method resolver
     if (Config::has($config)) {
         $function = Config::get($config);
         return $function($this);
     }
     #i: No relation found, return the call to parent (Eloquent) to handle it.
     return parent::__call($method, $parameters);
 }
开发者ID:mikemand,项目名称:User,代码行数:13,代码来源:User.php

示例9: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../config/pdf.php', 'pdf');
     $this->app->bind('mpdf.wrapper', function ($app, $cfg) {
         if (Config::has('pdf.custom_font_path') && Config::has('pdf.custom_font_data')) {
             define(_MPDF_SYSTEM_TTFONTS_CONFIG, __DIR__ . '/../mpdf_ttfonts_config.php');
         }
         $mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.format'), Config::get('pdf.default_font_size'), Config::get('pdf.default_font'), Config::get('pdf.margin_left'), Config::get('pdf.margin_right'), Config::get('pdf.margin_top'), Config::get('pdf.margin_bottom'), Config::get('pdf.margin_header'), Config::get('pdf.margin_footer'), Config::get('pdf.orientation'));
         $mpdf->SetTitle(Config::get('pdf.title'));
         $mpdf->SetAuthor(Config::get('pdf.author'));
         $mpdf->SetWatermarkText(Config::get('pdf.watermark'));
         $mpdf->SetDisplayMode(Config::get('pdf.display_mode'));
         $mpdf->showWatermarkText = Config::get('pdf.show_watermark');
         $mpdf->watermark_font = Config::get('pdf.watermark_font');
         $mpdf->watermarkTextAlpha = Config::get('pdf.watermark_text_alpha');
         return new PdfWrapper($mpdf);
     });
 }
开发者ID:niklasravnsborg,项目名称:laravel-pdf,代码行数:23,代码来源:PdfServiceProvider.php

示例10: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $section = $this->argument('section');
     if (!empty($section)) {
         if (!Config::has($section)) {
             $this->error($section . ' does not exist in your configuration.');
             return;
         }
         $configs = [$section => Config::get($section)];
     } else {
         $configs = Config::all();
         ksort($configs);
     }
     foreach ($configs as $section => $config) {
         $depth = $this->getConfigDepth($config);
         $tree = $this->generateTree($config, $depth);
         $this->line('<info>Configuration:</info> <comment>' . $section . '</comment>');
         $this->table([], $tree, 'default');
     }
 }
开发者ID:brianseitel,项目名称:laravel-examine-config,代码行数:25,代码来源:ExamineConfigCommand.php

示例11: getElocryptPrefix

 /**
  * Get the configuration setting for the prefix used to determine if a string is encrypted.
  *
  * @return string
  */
 protected function getElocryptPrefix()
 {
     return Config::has('elocrypt.prefix') ? Config::get('elocrypt.prefix') : '__ELOCRYPT__:';
 }
开发者ID:delatbabel,项目名称:elocryptfive,代码行数:9,代码来源:ReEncrypt.php

示例12: getLocaleInstance

 /**
  * Fetch the locale instance.
  *
  * @throws \Ngocnh\Translator\TranslatorException
  *
  * @return mixed
  */
 private function getLocaleInstance()
 {
     if (!Config::has('translator.locale')) {
         throw new TranslatableException('Please set the \'locale\' property in the configuration to your Locale model path.');
     }
     return App::make(Config::get('translator.locale'));
 }
开发者ID:ngocnh,项目名称:translator,代码行数:14,代码来源:Translatable.php

示例13: menu

 public function menu()
 {
     if (Config::has('admin.menu')) {
         return Config::get('admin.menu');
     }
 }
开发者ID:barryzhang,项目名称:laravel-admin,代码行数:6,代码来源:Admin.php

示例14: isConfigPublished

 /**
  * Checks if the app has the transformers package configuration.
  *
  * @return mixed
  */
 public static function isConfigPublished()
 {
     return Config::has('transformers.transformers');
 }
开发者ID:logaretm,项目名称:transformers,代码行数:9,代码来源:Transformer.php

示例15: function

<?php

use Illuminate\Support\Facades\Config;
/*
|--------------------------------------------------------------------------
| Package Routes
|--------------------------------------------------------------------------
|
*/
$options = ['prefix' => Config::get('api.prefix', 'api')];
if (Config::has('api.middleware')) {
    $options['middleware'] = Config::get('api.middleware');
}
Route::group($options, function () {
    // These routes are using the api.php config file to map {resource} and {relation} to Models
    Route::get('/{resource}', 'DefaultRestController@index');
    Route::get('/{resource}/{id}', 'DefaultRestController@show');
    Route::post('/{resource}', 'DefaultRestController@store');
    Route::put('/{resource}/{id}', 'DefaultRestController@update');
    Route::delete('/{resource}/{id}', 'DefaultRestController@destroy');
    Route::get('/{resource}/{id}/{relation}', 'DefaultRestController@indexRelation');
});
开发者ID:ZzAntares,项目名称:laravel-rest,代码行数:22,代码来源:routes.php


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