瀏覽代碼

20220901 終版報名表單欄位

LuluFJ.Ho 2 年之前
父節點
當前提交
69110fac39

+ 43
- 5
app/Http/Controllers/Api/SeminarSignUpController.php 查看文件

@@ -23,18 +23,56 @@ class SeminarSignUpController extends ApiController
23 23
     public function insertData(StoreRequest $request)
24 24
     {
25 25
         // \Log::info(print_r($request,true));
26
-        
27
-        $name = $this->safeEncrypt($request->input('name', ''), 'arm');
28
-        $email = $this->safeEncrypt($request->input('email', ''), 'arm');
29
-        $mobile = $this->safeEncrypt($request->input('mobile', ''), 'arm');
30 26
         $trackNo = $request->input('trackNo', '');
31 27
         
28
+        $firstName = $this->safeEncrypt($request->input('firstName', ''), 'arm');
29
+        $lastName = $this->safeEncrypt($request->input('lastName', ''), 'arm');
30
+        $companyName = $this->safeEncrypt($request->input('companyName', ''), 'arm');
31
+        $companyEmail = $this->safeEncrypt($request->input('companyEmail', ''), 'arm');
32
+        
33
+        $backupEmail = $request->input('backupEmail', '');
34
+        if (!is_null($backupEmail)) {
35
+            $backupEmail = $this->safeEncrypt($backupEmail, 'arm');
36
+        }
37
+
38
+        $phoneNumber = $this->safeEncrypt($request->input('phoneNumber', ''), 'arm');
39
+        $country = $request->input('country', '');
40
+        $registeredSession = $request->input('registeredSession', '');
41
+        $lunchOptions = $request->input('lunchOptions', '');
42
+        $typeOfIndustry = $request->input('typeOfIndustry', '');
43
+        $typeOfJob = $request->input('typeOfJob', '');
44
+        $jobTitle = $request->input('jobTitle', '');
45
+        $trackOfInterest = $request->input('trackOfInterest', '');
46
+        $areaOfInterest = $request->input('areaOfInterest', '');
47
+        $howToKnowAboutTheEvent = $request->input('howToKnowAboutTheEvent', '');
48
+        $consentAcceptEmail = $request->input('consentAcceptEmail', '');
49
+        $consentPrivacyPolicy = $request->input('consentPrivacyPolicy', '');
50
+        
32 51
         $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo);
33 52
         \Log::info($overOrNot);
34 53
 
35 54
         if ($overOrNot) {
36 55
 
37
-            $this->seminarSignUpSv->insertData($name, $email, $mobile, $trackNo);
56
+            $this->seminarSignUpSv->insertData(
57
+                $firstName, 
58
+                $lastName, 
59
+                $companyName, 
60
+                $companyEmail, 
61
+                $backupEmail, 
62
+                $phoneNumber, 
63
+                $country, 
64
+                $trackNo, 
65
+                $registeredSession,
66
+                $lunchOptions,
67
+                $typeOfIndustry,
68
+                $typeOfJob,
69
+                $jobTitle,
70
+                $trackOfInterest,
71
+                $areaOfInterest,
72
+                $howToKnowAboutTheEvent,
73
+                $consentAcceptEmail,
74
+                $consentPrivacyPolicy,
75
+            );
38 76
             $res = '報名成功';
39 77
         } else {
40 78
 

+ 37
- 9
app/Http/Requests/Api/SeminarSignUp/StoreRequest.php 查看文件

@@ -7,23 +7,51 @@ class StoreRequest extends FormRequest
7 7
 {
8 8
     public function rules(): array
9 9
     {
10
-        // $name, $email, $mobile, $trackNo
11 10
         return [
12
-            'name'      => 'required',
13
-            'email'     => 'required|email',
14
-            'mobile'    => 'required',
15
-            'trackNo'   => 'required'
11
+            'trackNo'   => 'required',
12
+            'firstName'     => 'required',
13
+            'lastName'      => 'required',
14
+            'companyName'   => 'required',
15
+            'companyEmail'  => 'required|email',
16
+            'backupEmail'   => 'nullable|email',
17
+            'phoneNumber'    => 'required',
18
+            'country'   => 'required',
19
+            // 'registeredSession'   => 'required',    // 如果選擇台灣track則必填
20
+            // 'lunchOptions'   => 'required',         // 如果選擇台灣track則必填
21
+            'typeOfIndustry'   => 'required',
22
+            'typeOfJob'   => 'required',
23
+            'jobTitle'   => 'required',
24
+            'trackOfInterest'   => 'required',
25
+            'areaOfInterest'   => 'required',
26
+            'howToKnowAboutTheEvent'   => 'required',
27
+            'consentAcceptEmail'   => 'required',
28
+            'consentPrivacyPolicy'   => 'required',
29
+            
16 30
         ];
17 31
     }
18 32
 
19 33
     public function messages(): array
20 34
     {
21 35
         return [
22
-            'name.required'     => 'column [name] is required.',
23
-            'email.required'    => 'column [email] is required.',
24
-            'email.email'       => 'column [email] format error',
25
-            'mobile.required'   => 'column [mobile] is required.',
26 36
             'trackNo.required'  => 'column [trackNo] is required.',
37
+            'firstName.required'    => 'column [firstName] is required.',
38
+            'lastName.required'     => 'column [lastName] is required.',
39
+            'companyName.required'  => 'column [companyName] is required.',
40
+            'companyEmail.required' => 'column [companyEmail] is required.',
41
+            'companyEmail.email'    => 'column [companyEmail] format error',
42
+            'backupEmail.email'     => 'column [backupEmail] format error',
43
+            'phoneNumber.required'  => 'column [phoneNumber] is required.',
44
+            'country.required'  => 'column [country] is required.',
45
+            // 'registeredSession.required'  => 'column [registeredSession] is required.',     // 如果選擇台灣track則必填
46
+            // 'lunchOptions.required'  => 'column [lunchOptions] is required.',     // 如果選擇台灣track則必填
47
+            'typeOfIndustry.required'  => 'column [typeOfIndustry] is required.',
48
+            'typeOfJob.required'  => 'column [typeOfJob] is required.',
49
+            'jobTitle.required'  => 'column [jobTitle] is required.',
50
+            'trackOfInterest.required'  => 'column [trackOfInterest] is required.',
51
+            'areaOfInterest.required'  => 'column [areaOfInterest] is required.',
52
+            'howToKnowAboutTheEvent.required'  => 'column [howToKnowAboutTheEvent] is required.',
53
+            'consentAcceptEmail.required'  => 'column [consentAcceptEmail] is required.',
54
+            'consentPrivacyPolicy.required'  => 'column [consentPrivacyPolicy] is required.',
27 55
         ];
28 56
     }
29 57
 }

+ 23
- 6
app/Http/Services/Web/SeminarSignUpService.php 查看文件

@@ -20,16 +20,33 @@ class SeminarSignUpService
20 20
         
21 21
     }
22 22
     
23
-    public function insertData($name, $email, $mobile, $trackNo)
23
+    public function insertData(
24
+        $trackNo, $firstName, $lastName, $companyName, $companyEmail, $backupEmail, $phoneNumber, $country, 
25
+        $registeredSession, $lunchOptions, $typeOfIndustry, $typeOfJob, $jobTitle, $trackOfInterest, $areaOfInterest, $howToKnowAboutTheEvent, 
26
+        $consentAcceptEmail, $consentPrivacyPolicy)
24 27
     {
25 28
         
26 29
         $this->signupDb
27 30
             ->insert([
28
-                'name' => $name,
29
-                'email' => $email,
30
-                'mobile' => $mobile,
31
-                'trackNo' => $trackNo,
32
-                'createDate' => date("Y-m-d H:i:s"),
31
+                'firstName'     => $firstName,
32
+                'lastName'      => $lastName,
33
+                'companyName'   => $companyName,
34
+                'companyEmail'  => $companyEmail,
35
+                'backupEmail'   => $backupEmail,
36
+                'phoneNumber'   => $phoneNumber,
37
+                'country'       => $country,
38
+                'trackNo'       => $trackNo,
39
+                'registeredSession' => $registeredSession,
40
+                'lunchOptions'      => $lunchOptions,
41
+                'typeOfIndustry'    => $typeOfIndustry,
42
+                'typeOfJob'     => $typeOfJob,
43
+                'jobTitle'      => $jobTitle,
44
+                'trackOfInterest'   => $trackOfInterest,
45
+                'areaOfInterest'    => $areaOfInterest,
46
+                'howToKnowAboutTheEvent'    => $howToKnowAboutTheEvent,
47
+                'consentAcceptEmail'    => $consentAcceptEmail,
48
+                'consentPrivacyPolicy'    => $consentPrivacyPolicy,
49
+                'createDate'    => date("Y-m-d H:i:s"),
33 50
             ]);
34 51
         
35 52
     }