From c985bb511b00b20cdfaafb51033b3ec3cfc103b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C4=B1rat?= Date: Fri, 11 Sep 2015 14:10:38 +0300 Subject: [PATCH] View set key Example : {!! Recaptcha::instantRender($config['siteKey']) !!} --- src/Recaptcha.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Recaptcha.php b/src/Recaptcha.php index d4824bb..a30f480 100644 --- a/src/Recaptcha.php +++ b/src/Recaptcha.php @@ -17,6 +17,29 @@ public function __construct($service, $config) $this->service = $service; $this->config = $config; } + + /** + * View render + * + * @param $parameter + * @return \Greggilbert\Recaptcha\view + */ + public function instantRender($parameter) + { + $options = []; + + if (is_string($parameter)) { + $this->config['public_key'] = $parameter; + } + + if (!empty($parameter['public_key'])) { + $this->config['public_key'] = $parameter['public_key']; + $options = $parameter; + } + + // Array + return $this->render($options); + } /** * Render the recaptcha