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


PHP Application::getInstance方法代码示例

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


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

示例1: createValidator

 /**
  * Function creates validator object using IoC calls
  *
  * @return AbstractValidator
  * @throws Exception
  */
 protected static function createValidator()
 {
     $className = self::getValidatorClass();
     if (!class_exists($className)) {
         throw new Exception("Cannot load validator class '{$className}' for model '" . static::class . "'");
     }
     return Application::getInstance()->make($className);
 }
开发者ID:fhteam,项目名称:laravel-validator,代码行数:14,代码来源:EloquentValidatingTrait.php

示例2: registerClosure

 /**
  * Registers provided closure as a validation rule. Useful for quick & dirty validation
  *
  * @param string              $ruleName
  * @param string|Closure      $validateFunction
  * @param string|Closure|null $replaceFunction
  */
 public static function registerClosure($ruleName, $validateFunction, $replaceFunction = null)
 {
     /** @var Factory $validatorFactory */
     $validatorFactory = Application::getInstance()->make(Factory::class);
     $validatorFactory->extend($ruleName, $validateFunction);
     if (null !== $replaceFunction) {
         $validatorFactory->replacer($ruleName, $replaceFunction);
     }
 }
开发者ID:fhteam,项目名称:laravel-validator,代码行数:16,代码来源:ValidationRuleRegistry.php

示例3: file

 function __construct()
 {
     $filePath = Application::getInstance()->storagePath() . '/files/pinyin.db';
     if (file_exists($filePath)) {
         $records = file($filePath);
         foreach ($records as $record) {
             $record = trim($record);
             $this->map[substr($record, 0, 3)] = substr($record, 4, strlen($record) - 3);
         }
     }
 }
开发者ID:ruby97,项目名称:faker,代码行数:11,代码来源:Pinyin.php

示例4: getInstance

 /**
  * Set the globally available instance of the container.
  *
  * @return static 
  * @static 
  */
 public static function getInstance()
 {
     //Method inherited from \Illuminate\Container\Container
     return \Illuminate\Foundation\Application::getInstance();
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例5: __construct

 public function __construct($items = [], $addons = null)
 {
     parent::__construct($items);
     $this->app = \Illuminate\Foundation\Application::getInstance();
     $this->addons = $addons ?: $this->app->make('codex.addons');
 }
开发者ID:codexproject,项目名称:core,代码行数:6,代码来源:BaseCollection.php

示例6: getLocale

 /**
  * @return string
  * @author Rytis Grincevičius <rytis.grincevicius@gmail.com>
  */
 public static function getLocale()
 {
     return Application::getInstance()->getLocale();
 }
开发者ID:kiberzauras,项目名称:laravel.translator,代码行数:8,代码来源:Translator.php

示例7: translation_path

 /**
  * @param string $path
  * @param string $locale
  * @return string
  * @author Rytis Grincevičius <rytis.grincevicius@gmail.com>
  */
 public static function translation_path($path = '', $locale = '')
 {
     $locale = $locale ? $locale : Application::getInstance()->getLocale();
     $path = self::parse_path($path);
     return self::translations_path($locale . ($path ? DIRECTORY_SEPARATOR . $path : $path));
 }
开发者ID:kiberzauras,项目名称:laravel.translator,代码行数:12,代码来源:Path.php


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