當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。