diff --git a/README.md b/README.md
index 68b25d8..c421fc1 100644
--- a/README.md
+++ b/README.md
@@ -21,19 +21,23 @@ Next, add this line to 'providers' section of the app config file in `app/config
'Msurguy\Honeypot\HoneypotServiceProvider',
+Add the honeypot facade:
+
+ 'Honeypot' => 'Msurguy\Honeypot\HoneypotFacade'
+
At this point the package is installed and you can use it as follows.
## Usage :
-Add the hidden DIV containing honeypot fields to your form by inserting `Form::honeypot` macro like this:
+Add the honeypot catcher to your form by inserting `Honeypot::generate(..)` like this:
{{ Form::open('contact') }}
...
- {{ Form::honeypot('my_name', 'my_time') }}
+ {{ Honeypot::generate('my_name', 'my_time') }}
...
{{ Form::close() }}
-When the page containing `Form::honeypot` macro is rendered, the following HTML markup will be present (my_time field will contain an encrypted timestamp):
+The `generate` method will output the following HTML markup (`my_time` field will contain an encrypted timestamp):
diff --git a/src/Msurguy/Honeypot/Honeypot.php b/src/Msurguy/Honeypot/Honeypot.php
index 8ac053f..1b35e1f 100644
--- a/src/Msurguy/Honeypot/Honeypot.php
+++ b/src/Msurguy/Honeypot/Honeypot.php
@@ -5,12 +5,12 @@
class Honeypot {
/**
- * Get the honey pot form HTML
+ * Generate a new honeypot and return the form HTML
* @param string $honey_name
* @param string $honey_time
* @return string
*/
- public function getFormHTML($honey_name, $honey_time)
+ public function generate($honey_name, $honey_time)
{
// Encrypt the current time
$honey_time_encrypted = $this->getEncryptedTime();
diff --git a/src/Msurguy/Honeypot/HoneypotServiceProvider.php b/src/Msurguy/Honeypot/HoneypotServiceProvider.php
index 423058e..d7d703e 100644
--- a/src/Msurguy/Honeypot/HoneypotServiceProvider.php
+++ b/src/Msurguy/Honeypot/HoneypotServiceProvider.php
@@ -1,6 +1,5 @@
extend('honeypot', 'Msurguy\Honeypot\HoneypotValidator@validateHoneypot', $translator->get('honeypot::validation.honeypot'));
$validator->extend('honeytime', 'Msurguy\Honeypot\HoneypotValidator@validateHoneytime', $translator->get('honeypot::validation.honeytime'));
-
- // Register the honeypot form macros
- $this->registerFormMacro($this->isLaravelVersion(['4.0', '4.1']) ? $app['form'] : null);
});
}
@@ -68,30 +64,6 @@ public function provides()
return array('honeypot');
}
- /**
- * Register the honeypot form macro
- *
- * @param Illuminate\Html\FormBuilder|null $form
- * @return void
- */
- public function registerFormMacro(FormBuilder $form = null)
- {
- $honeypotMacro = function($honey_name, $honey_time) {
- $honeypot = new Honeypot();
- return $honeypot->getFormHTML($honey_name, $honey_time);
- };
-
- // Add a custom honeypot macro to Laravel's form
- if ($form)
- {
- $form->macro('honeypot', $honeypotMacro);
- }
- else
- {
- FormBuilder::macro('honeypot', $honeypotMacro);
- }
- }
-
/**
* Determine if laravel starts with any of the given version strings
*