Skip to content

Commit

Permalink
added field render
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanDaDeng committed Jan 26, 2019
1 parent a3dba27 commit 8368c67
Showing 1 changed file with 48 additions and 11 deletions.
59 changes: 48 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,38 +244,75 @@ It's recommended to include reCAPTCHA v3 on every page which can help you get th

#### Blade for Form & Action

Include div with an ID inside your form, e.g.
There are three methods to populate the reCAPTCHA within the form.

- render() and renderOne() can be placed in anywhere.
- renderField() needs always to be placed within your form.

Method one - render():

``` html
<div id="contact_us_id"></div>
```
[
$id=>$action , $id=>$action ...
]
Include GoogleReCaptchaV3::render() script after your form, params should follow 'ID'=>'Action', e.g.
{!! GoogleReCaptchaV3::render(['contact_us_id'=>'contact_us', 'signup_id'=>'signup']) !!}
```

``` html
{{--if laravel version <=5.6, please use {{ csrf_field() }}--}}

<form method="POST" action="/verify">
@csrf
<div id="contact_us_id"></div>
<div id="contact_us_id"></div> // add div with id
<input type="submit" value="submit">
</form>


<form method="POST" action="/verify">
@csrf
<div id="signup_id"></div>
<input type="submit" value="submit">
</form>

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

// or
```

Method two - renderOne():

```
GoogleReCaptchaV3::renderOne($id,$action);
{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!}
```

``` html
<form method="POST" action="/verify">
<div id="contact_us_id"></div> // add div with id
<input type="submit" value="submit">
</form>

{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!}

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


Method three - renderField():

```
GoogleReCaptchaV3::renderField($id,$action,$class,$style)
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
```


``` html

<form method="POST" action="/verify">
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
<input type="submit" value="submit">
</form>


```

### Badge Display for Form & Action

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

0 comments on commit 8368c67

Please sign in to comment.