| 
				
			 | 
			
			
				@@ -22,15 +22,21 @@ class SeminarSignUpController extends ApiController 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				     // save data to db 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				     public function insertData(StoreRequest $request) 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				     { 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-        \Log::info(print_r($request->all(),true)); 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				25
			 | 
			
			
				         $trackNo = $request->input('trackNo', ''); 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				
			 | 
			
			
				-        $firstName = $this->safeEncrypt($request->input('firstName', ''), 'arm'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+        $lang = substr($trackNo, 0, 2); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+        $firstName_orig = $request->input('firstName', ''); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+        $firstName = $this->safeEncrypt($firstName_orig, 'arm'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				30
			 | 
			
			
				         $lastName = $this->safeEncrypt($request->input('lastName', ''), 'arm'); 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				31
			 | 
			
			
				         $companyName = $this->safeEncrypt($request->input('companyName', ''), 'arm'); 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				
			 | 
			
			
				-        $companyEmail = $this->safeEncrypt($request->input('companyEmail', ''), 'arm'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+        $companyEmail_orig = $request->input('companyEmail', ''); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+        $companyEmail = $this->safeEncrypt($companyEmail_orig, 'arm'); 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				35
			 | 
			
			
				          
			 | 
		
	
		
			
			| 
				32
			 | 
			
				36
			 | 
			
			
				         $backupEmail = $request->input('backupEmail', ''); 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				37
			 | 
			
			
				         if (!is_null($backupEmail)) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+         
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+            $backupEmail_orig = $request->input('backupEmail', ''); 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				40
			 | 
			
			
				             $backupEmail = $this->safeEncrypt($backupEmail, 'arm'); 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				41
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				42
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -48,7 +54,6 @@ class SeminarSignUpController extends ApiController 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				54
			 | 
			
			
				         $consentPrivacyPolicy = $request->input('consentPrivacyPolicy', ''); 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				55
			 | 
			
			
				          
			 | 
		
	
		
			
			| 
				50
			 | 
			
				56
			 | 
			
			
				         $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo); 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				
			 | 
			
			
				-        \Log::info($overOrNot); 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				57
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				53
			 | 
			
				58
			 | 
			
			
				         if ($overOrNot) { 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				59
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -73,6 +78,17 @@ class SeminarSignUpController extends ApiController 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				78
			 | 
			
			
				                 $consentPrivacyPolicy, 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				79
			 | 
			
			
				             ); 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				80
			 | 
			
			
				             $res = '報名成功'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				+            if ($lang=='TW') { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+                $this->mailToUser_TW($firstName_orig, $companyEmail_orig, $backupEmail_orig); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				+            } elseif ($lang=='JP') { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+                $this->mailToUser_JP($firstName_orig, $companyEmail_orig, $backupEmail_orig); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+            } elseif ($lang=='KR') { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				+                $this->mailToUser_KR($firstName_orig, $companyEmail_orig, $backupEmail_orig); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+            } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				+                $this->mailToUser_EN($firstName_orig, $companyEmail_orig, $backupEmail_orig); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+            } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				+             
			 | 
		
	
		
			
			| 
				76
			 | 
			
				92
			 | 
			
			
				         } else { 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				93
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				78
			 | 
			
				94
			 | 
			
			
				             $res = '已達報名上限'; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -80,14 +96,12 @@ class SeminarSignUpController extends ApiController 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				96
			 | 
			
			
				         $data = [ 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				97
			 | 
			
			
				             'res' => $res, 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				98
			 | 
			
			
				         ]; 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				
			 | 
			
			
				-        \Log::info(print_r($res,true)); 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				99
			 | 
			
			
				          
			 | 
		
	
		
			
			| 
				85
			 | 
			
				100
			 | 
			
			
				         return $this->apiResponse($data); 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				101
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				102
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				88
			 | 
			
				103
			 | 
			
			
				     public function getData() 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				104
			 | 
			
			
				     { 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				
			 | 
			
			
				-         
			 | 
		
	
		
			
			| 
				91
			 | 
			
				105
			 | 
			
			
				         $list = $this->seminarSignUpSv->getData(); 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				106
			 | 
			
			
				          
			 | 
		
	
		
			
			| 
				93
			 | 
			
				107
			 | 
			
			
				         $data = [ 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -153,4 +167,50 @@ class SeminarSignUpController extends ApiController 
			 | 
		
	
		
			
			| 
				153
			 | 
			
				167
			 | 
			
			
				         return base64_decode(join('', $strArr)); 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				168
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				155
			 | 
			
				169
			 | 
			
			
				      
			 | 
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				+    public function mailToUser_TW(string $firstName='', string $companyEmail='', string $backupEmail='') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+        $data = array('name'=>$firstName); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+        \Mail::send(['text'=>'mailTW'], $data, function($message) use ($companyEmail, $firstName, $backupEmail) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+            $message->to($companyEmail, $firstName)->subject('報名成功');       // Registration is complete 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+            $message->cc($backupEmail, $firstName)->subject('報名成功');       // Registration is complete 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+            $message->from('no-reply@erapr.com.tw','Arm Tech Symposia 2'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+    public function mailToUser_JP(string $firstName='', string $companyEmail='', string $backupEmail='') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+        $data = array('name'=>$firstName); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				184
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				185
			 | 
			
			
				+        \Mail::send(['text'=>'mailJP'], $data, function($message) use ($companyEmail, $firstName, $backupEmail) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				186
			 | 
			
			
				+            $message->to($companyEmail, $firstName)->subject('登録完了'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				187
			 | 
			
			
				+            $message->cc($backupEmail, $backupEmail)->subject('登録完了'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				188
			 | 
			
			
				+            $message->from('no-reply@erapr.com.tw','Arm Tech Symposia 2'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				189
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				191
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				+    public function mailToUser_KR(string $firstName='', string $companyEmail='', string $backupEmail='') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				193
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				194
			 | 
			
			
				+        $data = array('name'=>$firstName); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				195
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				196
			 | 
			
			
				+        \Mail::send(['text'=>'mailKR'], $data, function($message) use ($companyEmail, $firstName, $backupEmail) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				197
			 | 
			
			
				+            $message->to($companyEmail, $firstName)->subject('등록이 완료되었습니다'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				+            $message->cc($backupEmail, $firstName)->subject('등록이 완료되었습니다'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				+            $message->from('no-reply@erapr.com.tw','Arm Tech Symposia 2'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				200
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				201
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				202
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				203
			 | 
			
			
				+    public function mailToUser_EN(string $firstName='', string $companyEmail='', string $backupEmail='') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				204
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				205
			 | 
			
			
				+        $data = array('name'=>$firstName); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				206
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				207
			 | 
			
			
				+        \Mail::send(['text'=>'mailEN'], $data, function($message) use ($companyEmail, $firstName, $backupEmail) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				208
			 | 
			
			
				+            $message->to($companyEmail, $firstName)->subject('Registration is complete'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				209
			 | 
			
			
				+            $message->cc($backupEmail, $firstName)->subject('Registration is complete'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				210
			 | 
			
			
				+            $message->from('no-reply@erapr.com.tw','Arm Tech Symposia 2'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				214
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+ 
			 |