1
|
|
|
<?php namespace Arcanedev\NoCaptcha; |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\Manager; |
4
|
|
|
use Arcanedev\NoCaptcha\Contracts\NoCaptchaManager as NoCaptchaManagerContract; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class NoCaptchaManager |
8
|
|
|
* |
9
|
|
|
* @package Arcanedev\NoCaptcha |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class NoCaptchaManager extends Manager implements NoCaptchaManagerContract |
13
|
|
|
{ |
14
|
|
|
/* ----------------------------------------------------------------- |
15
|
|
|
| Getters |
16
|
|
|
| ----------------------------------------------------------------- |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Get the default driver name. |
21
|
|
|
* |
22
|
|
|
* @return string |
23
|
|
|
*/ |
24
|
4 |
|
public function getDefaultDriver() |
25
|
|
|
{ |
26
|
4 |
|
return config('no-captcha.version'); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/* ----------------------------------------------------------------- |
30
|
|
|
| Main Methods |
31
|
|
|
| ----------------------------------------------------------------- |
32
|
|
|
*/ |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get the NoCaptcha driver by the given version. |
36
|
|
|
* |
37
|
|
|
* @param string|null $version |
38
|
|
|
* |
39
|
|
|
* @return \Arcanedev\NoCaptcha\NoCaptchaV3|\Arcanedev\NoCaptcha\NoCaptchaV2 |
40
|
|
|
*/ |
41
|
20 |
|
public function version($version = null) |
42
|
|
|
{ |
43
|
20 |
|
return $this->driver($version); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return \Arcanedev\NoCaptcha\NoCaptchaV3 |
48
|
|
|
*/ |
49
|
4 |
|
public function createV2Driver() |
50
|
|
|
{ |
51
|
4 |
|
return new NoCaptchaV3( |
52
|
4 |
|
config('no-captcha.secret'), |
53
|
4 |
|
config('no-captcha.sitekey'), |
54
|
4 |
|
config('no-captcha.lang') ?: $this->app->getLocale() |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return \Arcanedev\NoCaptcha\NoCaptchaV3 |
60
|
|
|
*/ |
61
|
20 |
|
public function createV3Driver() |
62
|
|
|
{ |
63
|
20 |
|
return new NoCaptchaV3( |
64
|
20 |
|
config('no-captcha.secret'), |
65
|
20 |
|
config('no-captcha.sitekey'), |
66
|
20 |
|
config('no-captcha.lang') ?: $this->app->getLocale() |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|