コード例 #1
0
ファイル: TwilioVerify.php プロジェクト: j42/laravel-twilio
 protected function sendSms($phone, array $token, $message = null)
 {
     // Response(s) Indexed by Recipient Phone #(s)
     $responses = \Twilio::sms(['to' => $phone, 'message' => is_string($message) ? $message : $token['token'] . "\n\nPlease enter this code" . (Config::get('app.domain') ? ' on ' . $this->getDomain() : '') . " to complete the verification process."]);
     // Update Model
     if ($responses[$phone]->status === 'queued') {
         $this->phone = Cookie::get('twilio::phone');
     }
     // Respond w/ 2 Minute TTL
     return $this->respond(['phone' => $phone, 'status' => isset($responses[$phone]) ? $responses[$phone]->status : null], 200)->withCookie($token['cookie']);
 }