|
@@ -28,38 +28,40 @@ class RegionLimitedRules implements Rule, DataAwareRule
|
28
|
28
|
*/
|
29
|
29
|
public function passes($attribute, $value)
|
30
|
30
|
{
|
31
|
|
- //
|
32
|
|
- if (substr($value, 0, 2)=='TP'||substr($value, 0, 2)=='HS') {
|
|
31
|
+ if ($this->data['phoneNumber']) {
|
|
32
|
+ if (substr($value, 0, 2)=='TP'||substr($value, 0, 2)=='HS') {
|
33
|
33
|
|
34
|
|
- if (is_null($this->data['registeredSession'])) {
|
35
|
|
- return false;
|
36
|
|
- }
|
|
34
|
+ if (is_null($this->data['registeredSession'])) {
|
|
35
|
+ return false;
|
|
36
|
+ }
|
37
|
37
|
|
38
|
|
- if (is_null($this->data['lunchOptions'])) {
|
39
|
|
- return false;
|
40
|
|
- }
|
|
38
|
+ if (is_null($this->data['lunchOptions'])) {
|
|
39
|
+ return false;
|
|
40
|
+ }
|
41
|
41
|
|
42
|
|
- $pattern = '/09\d{2}\d{3}\d{3}/';
|
43
|
|
- $string = $this->data['phoneNumber'];
|
44
|
|
- if (!preg_match($pattern, $string, $matches)) {
|
45
|
|
- return false;
|
46
|
|
- }
|
|
42
|
+ $pattern = '/09\d{2}\d{3}\d{3}/';
|
|
43
|
+ $string = $this->data['phoneNumber'];
|
|
44
|
+ if (!preg_match($pattern, $string, $matches)) {
|
|
45
|
+ return false;
|
|
46
|
+ }
|
47
|
47
|
|
48
|
|
- } elseif (substr($value, 0, 2)=='JP') {
|
|
48
|
+ } elseif (substr($value, 0, 2)=='JP') {
|
49
|
49
|
|
50
|
|
- $pattern = '/^0[789]0\d{8}/';
|
51
|
|
- $string = $this->data['phoneNumber'];
|
52
|
|
- if (!preg_match( $pattern, $string, $matches)) {
|
53
|
|
- return false;
|
54
|
|
- }
|
55
|
|
- } elseif (substr($value, 0, 2)=='KR') {
|
|
50
|
+ $pattern = '/^0[789]0\d{8}/';
|
|
51
|
+ $string = $this->data['phoneNumber'];
|
|
52
|
+ if (!preg_match( $pattern, $string, $matches)) {
|
|
53
|
+ return false;
|
|
54
|
+ }
|
|
55
|
+ } elseif (substr($value, 0, 2)=='KR') {
|
56
|
56
|
|
57
|
|
- $pattern = '/^01\d{1}\d{4}\d{4}/';
|
58
|
|
- $string = $this->data['phoneNumber'];
|
59
|
|
- if (!preg_match( $pattern, $string, $matches)) {
|
60
|
|
- return false;
|
|
57
|
+ $pattern = '/^01\d{1}\d{4}\d{4}/';
|
|
58
|
+ $string = $this->data['phoneNumber'];
|
|
59
|
+ if (!preg_match( $pattern, $string, $matches)) {
|
|
60
|
+ return false;
|
|
61
|
+ }
|
61
|
62
|
}
|
62
|
63
|
}
|
|
64
|
+
|
63
|
65
|
return true;
|
64
|
66
|
}
|
65
|
67
|
|