Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function send_otp()
- {
- try {
- $account_sid = env('TWILIO_ACCOUNT_SID');
- $auth_token = env('TWILIO_AUTH_TOKEN');
- $number=Auth::user()->user_phone;
- $client = new Client($account_sid, $auth_token);
- $messages = $client->messages->create($number, array(
- 'From' => '+12533368077',
- 'Body' => Auth::user()->user_otp,
- ));
- dd($messages);
- //return $messages;
- //throw new Exception();
- } catch (Exception $e) {
- return response()->json(['error' => true,'message'=>'Something went wrong'],200);
- }
- }
Add Comment
Please, Sign In to add comment