/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Form::setStaticEventBus(new IlluminateBus($this->app['events']));
     Form::provideValidationBroker(function (Form $form) {
         $broker = new AutoValidatorBroker(new ValidatorFactory());
         $broker->setForm($form);
         return $broker;
     });
     Form::provideRequestProvider(function () {
         return $this->getRequestProvider();
     });
     Form::provideUrlProvider(function () {
         return $this->getActionUrlProvider();
     });
     Form::provideRenderer(function () {
         return $this->getRenderer();
     });
     Form::provideAdditionalNamer(function ($chain) {
         $chain->append($this->getTranslationNamer());
     });
     $this->app['events']->listen('form.renderer-changed', function ($renderer) {
         $this->addFormPaths($renderer);
     });
     $this->app->alias('formobject.factory', 'FormObject\\Factory');
     $this->app->singleton('formobject.factory', function ($app) {
         return Form::getFactory();
     });
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Form::setStaticEventBus(new IlluminateBus($this->app['events']));
     Form::provideValidationBroker(function (Form $form) {
         $broker = new AutoValidatorBroker(new ValidatorFactory());
         $broker->setForm($form);
         return $broker;
     });
     Form::provideRequestProvider(function () {
         return $this->getRequestProvider();
     });
     Form::provideUrlProvider(function () {
         return $this->getActionUrlProvider();
     });
     Form::provideRenderer(function () {
         return $this->getRenderer();
     });
     Form::provideAdditionalNamer(function ($chain) {
         $chain->append($this->getTranslationNamer());
     });
     $this->app['events']->listen('form.renderer-changed', function ($renderer) {
         $this->addFormPaths($renderer);
     });
     $this->app->alias('formobject.factory', 'FormObject\\Factory');
     $this->app->singleton('formobject.factory', function ($app) {
         $factory = Form::getFactory();
         $factory->createFieldsWith(function ($class) {
             return $this->app->make($class);
         });
         return $factory;
     });
     $this->app->afterResolving('XType\\Casting\\Contracts\\InputCaster', function ($caster) {
         $this->registerInputCasters($caster);
     });
 }