Guest User

Untitled

a guest
Mar 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public function send_otp()
  2. {
  3.  
  4. try {
  5. $account_sid = env('TWILIO_ACCOUNT_SID');
  6. $auth_token = env('TWILIO_AUTH_TOKEN');
  7. $number=Auth::user()->user_phone;
  8. $client = new Client($account_sid, $auth_token);
  9. $messages = $client->messages->create($number, array(
  10. 'From' => '+12533368077',
  11. 'Body' => Auth::user()->user_otp,
  12. ));
  13. dd($messages);
  14. //return $messages;
  15. //throw new Exception();
  16.  
  17. } catch (Exception $e) {
  18.  
  19. return response()->json(['error' => true,'message'=>'Something went wrong'],200);
  20. }
  21.  
  22. }
Add Comment
Please, Sign In to add comment