Skip to content

Commit

Permalink
Merge pull request #13 from antonioribeiro/validationAfterBoot
Browse files Browse the repository at this point in the history
Create validation extensions after application boot
  • Loading branch information
msurguy committed Jun 30, 2014
2 parents 1cd3357 + 178684c commit 6182df0
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Msurguy/Honeypot/HoneypotServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ public function boot()

$this->createMacroForm();

// Extend Laravel's validator (rule, function, messages)
$this->app['validator']->extend(
'honeypot',
'Msurguy\Honeypot\HoneypotValidator@validate',
$this->app['translator']->get('honeypot::validation.honeypot'
));
$this->app->booted(function($app) {
// Extend Laravel's validator (rule, function, messages)
$app['validator']->extend(
'honeypot',
'Msurguy\Honeypot\HoneypotValidator@validate',
$app['translator']->get('honeypot::validation.honeypot')
);

// Extend Laravel's validator (rule, function, messages)
$this->app['validator']->extend(
'honeytime',
'Msurguy\Honeypot\HoneytimeValidator@validate',
$this->app['translator']->get('honeypot::validation.honeytime')
);
// Extend Laravel's validator (rule, function, messages)
$app['validator']->extend(
'honeytime',
'Msurguy\Honeypot\HoneytimeValidator@validate',
$app['translator']->get('honeypot::validation.honeytime')
);
});
}

/**
Expand Down

0 comments on commit 6182df0

Please sign in to comment.