callApiService = $callApiService; $this->smsService = $smsService; $this->mailTemplateService = $mailTemplateService; } public function mail(Request $request) { $certNumber = rand(100000, 999999); $reqInfo = [ 'number' => $certNumber, 'date' => date('YmdHis'), 'time' => time(), 'email' => $request['ToMail'] ]; session()->put('mailCert', $reqInfo); try { if (! $this->mailTemplateService->send($request['Component'], [ 'C11' => $certNumber ], $request['ToMail'], $request['Subject'])) { return response()->json([ 'error' => true, 'message' => 'Failed to send password reset email, please try again.']); } } catch (Exception $e) { return response()->json(['error' => true, 'message' => 'Unauthorized']); } return response()->json(['error' => false, 'message' => 'Success']); } public function mobile(Request $request) { $receiver = $request['MobileNo']; $smsCert = rand(100000, 999999); $reqInfo = [ 'number' => $smsCert, 'date' => date('YmdHis'), 'time' => time(), 'mobile_no' => $receiver ]; $title ='본인확인'; $msg ="[Dabory] 본인확인 인증번호는 [{$smsCert}]입니다. 정확히 입력해주세요."; session()->put('smsCert.'.$request['Name'], $reqInfo); $response = $this->smsService->sendMessage($title, $msg, $receiver); return response()->json(['error' => false, 'message' => $response]); } }