/**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     /**
      * Extend the Laravel Validator with the "identity_number" rule
      */
     $this->app['validator']->extend('identity_number', function ($attribute, $value, $parameters) {
         return Pin::isValid($value, 'identity');
     });
     /**
      * Extend the Laravel Validator with the "organization_number" rule
      */
     $this->app['validator']->extend('organization_number', function ($attribute, $value, $parameters) {
         return Pin::isValid($value, 'organization');
     });
     /**
      * Extend the Laravel Validator with the "coordination_number" rule
      */
     $this->app['validator']->extend('coordination_number', function ($attribute, $value, $parameters) {
         return Pin::isValid($value, 'coordination');
     });
 }
Ejemplo n.º 2
0
 /** @test **/
 public function test_org_no_as_pin()
 {
     // Validate so that companies org. numbers doesn't pass as a PIN
     $this->assertFalse(Pin::isValid('556016-0681', 'organization'));
     // Ericsson AB
     $this->assertFalse(Pin::isValid('556103-4240', 'organization'));
     // Telia AB
     $this->assertFalse($this->validate('556809-9964'));
     // IKEA AB
     $this->assertFalse($this->validate('969663-7034'));
     // Skellefteå Energi Underhåll Handelsbolag
 }