當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Factory::resolver方法代碼示例

本文整理匯總了PHP中Illuminate\Validation\Factory::resolver方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::resolver方法的具體用法?PHP Factory::resolver怎麽用?PHP Factory::resolver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Validation\Factory的用法示例。


在下文中一共展示了Factory::resolver方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../config/captcha.php', 'mews.captcha');
     /**
      * @param $app
      * @return Captcha
      */
     $this->app->bind('captcha', function ($app) {
         return new Captcha($app['Illuminate\\Filesystem\\Filesystem'], $app['Illuminate\\Config\\Repository'], $app['Intervention\\Image\\ImageManager'], $app['Illuminate\\Session\\Store'], $app['Illuminate\\Hashing\\BcryptHasher'], $app['Illuminate\\Support\\Str']);
     });
     /**
      * @param Captcha $captcha
      * @param $config
      * @return \Intervention\Image\ImageManager
      */
     $this->app['router']->get('captcha/{config?}', 'Chekun\\Captcha\\CaptchaController@draw');
     $this->app['validator'] = $this->app->share(function ($app) {
         $validator = new Factory($app['translator']);
         $validator->setPresenceVerifier($this->app['validation.presence']);
         $validator->resolver(function ($translator, $data, $rules, $messages) {
             return new CaptchaValidator($translator, $data, $rules, $messages);
         });
         return $validator;
     });
 }
開發者ID:chekun,項目名稱:captcha,代碼行數:30,代碼來源:CaptchaServiceProvider.php

示例2: testCustomResolverIsCalled

 public function testCustomResolverIsCalled()
 {
     unset($_SERVER['__validator.factory']);
     $translator = m::mock('Symfony\\Component\\Translation\\TranslatorInterface');
     $factory = new Factory($translator);
     $factory->resolver(function ($translator, $data, $rules) {
         $_SERVER['__validator.factory'] = true;
         return new Illuminate\Validation\Validator($translator, $data, $rules);
     });
     $validator = $factory->make(array('foo' => 'bar'), array('baz' => 'boom'));
     $this->assertTrue($_SERVER['__validator.factory']);
     $this->assertEquals($translator, $validator->getTranslator());
     $this->assertEquals(array('foo' => 'bar'), $validator->getData());
     $this->assertEquals(array('baz' => array('boom')), $validator->getRules());
     unset($_SERVER['__validator.factory']);
 }
開發者ID:j-ew-s,項目名稱:BabyName,代碼行數:16,代碼來源:FactoryTest.php

示例3: register

 public function register()
 {
     $this->app->singleton('validation.presence', function ($app) {
         return new DatabasePresenceVerifier($app['db']);
     });
     $this->app->singleton('validator', function ($app) {
         $validator = new Factory($app['translator'], $app);
         $validator->resolver(function ($translator, $data, $rules, $messages, $customAttributes) {
             return new \App\Http\Services\Validator($translator, $data, $rules, $messages, $customAttributes);
         });
         // The validation presence verifier is responsible for determining the existence
         // of values in a given data collection, typically a relational database or
         // other persistent data stores. And it is used to check for uniqueness.
         if (isset($app['validation.presence'])) {
             $validator->setPresenceVerifier($app['validation.presence']);
         }
         return $validator;
     });
 }
開發者ID:Nebo15,項目名稱:gandalf.api,代碼行數:19,代碼來源:ValidationServiceProvider.php

示例4: resolver

 /**
  * Set the Validator instance resolver.
  *
  * @param \Closure $resolver
  * @return void 
  * @static 
  */
 public static function resolver($resolver)
 {
     \Illuminate\Validation\Factory::resolver($resolver);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:11,代碼來源:_ide_helper.php

示例5: resolver

 /**
  * Set the Validator instance resolver.
  *
  * @param  \Closure $resolver
  * @return void
  */
 public function resolver(Closure $resolver)
 {
     $this->factory->resolver($resolver);
 }
開發者ID:Kremon,項目名稱:laravel-jsvalidation,代碼行數:10,代碼來源:Factory.php

示例6: getValidationFactory

 /**
  * @return \Illuminate\Validation\Factory
  */
 public function getValidationFactory()
 {
     if (isset($this->app['validator'])) {
         return $this->app['validator'];
     }
     $factory = new Factory(new IdentityTranslator(), $this->app);
     if ($this->override !== null) {
         $factory->resolver($this->override);
     }
     return $factory;
 }
開發者ID:okneloper,項目名稱:forms,代碼行數:14,代碼來源:IlluminateValidatorResolver.php


注:本文中的Illuminate\Validation\Factory::resolver方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。