当前位置: 首页>>代码示例>>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;未经允许,请勿转载。