Skip to content

Commit 8368c67

Browse files
committed
added field render
1 parent a3dba27 commit 8368c67

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

README.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,38 +244,75 @@ It's recommended to include reCAPTCHA v3 on every page which can help you get th
244244

245245
#### Blade for Form & Action
246246

247-
Include div with an ID inside your form, e.g.
247+
There are three methods to populate the reCAPTCHA within the form.
248+
249+
- render() and renderOne() can be placed in anywhere.
250+
- renderField() needs always to be placed within your form.
251+
252+
Method one - render():
248253

249-
``` html
250-
<div id="contact_us_id"></div>
251254
```
255+
[
256+
$id=>$action , $id=>$action ...
257+
]
252258
253-
Include GoogleReCaptchaV3::render() script after your form, params should follow 'ID'=>'Action', e.g.
259+
{!! GoogleReCaptchaV3::render(['contact_us_id'=>'contact_us', 'signup_id'=>'signup']) !!}
260+
```
254261

255262
``` html
256-
{{--if laravel version <=5.6, please use {{ csrf_field() }}--}}
257-
258263
<form method="POST" action="/verify">
259-
@csrf
260-
<div id="contact_us_id"></div>
264+
<div id="contact_us_id"></div> // add div with id
261265
<input type="submit" value="submit">
262266
</form>
263267

264268

265269
<form method="POST" action="/verify">
266-
@csrf
267270
<div id="signup_id"></div>
268271
<input type="submit" value="submit">
269272
</form>
270273

271274
{!! GoogleReCaptchaV3::render(['contact_us_id'=>'contact_us', 'signup_id'=>'signup']) !!}
272275

273-
// or
276+
```
277+
278+
Method two - renderOne():
279+
280+
```
281+
GoogleReCaptchaV3::renderOne($id,$action);
282+
283+
{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!}
284+
```
285+
286+
``` html
287+
<form method="POST" action="/verify">
288+
<div id="contact_us_id"></div> // add div with id
289+
<input type="submit" value="submit">
290+
</form>
291+
292+
{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!}
274293

275-
{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!} // renderOne($id,$action)
276294
```
277295

278296

297+
Method three - renderField():
298+
299+
```
300+
GoogleReCaptchaV3::renderField($id,$action,$class,$style)
301+
302+
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
303+
```
304+
305+
306+
``` html
307+
308+
<form method="POST" action="/verify">
309+
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
310+
<input type="submit" value="submit">
311+
</form>
312+
313+
314+
```
315+
279316
### Badge Display for Form & Action
280317

281318
If your settings were not reflected, please run php artisan config:cache to clear cache.

0 commit comments

Comments
 (0)