![]() ![]() * Get the Nexmo / SMS representation of the notification. * Get the notification's delivery channels. Go to the class ( app/Notifications/CustomSmsNotification.php) and add change it to be the following: message = $message Lastly, create a new notification class php artisan make:notification CustomSmsNotification This will let the notification system know what phone number to use for the user. ![]() use Illuminate\Notifications\Notifiable // phone To do this make sure if is using the Illuminate\Notifications\Notifiable trait e.g. Next, make sure your User model is set up to send the notification You should now be set up to actually send an sms with nexmo. You should generate a phone number for your application in the Nexmo control panel.Īdd your nexmo api key and nexmo secret to your. The sms_from option is the phone number that your SMS messages will be sent from. env and the value passed to the env() helper function will need to match the key in the. Do not replace NEXMO_KEY and NEXMO_SECRET in the above with your actual key and secret as they are going to be stored in the. NB Please only change the "your-nexmo-phone-number" part in the code above. To send a custom sms notification to all of your users, you could use Laravel's built-in notification system.Īll of the information you will need to get started is in the Documentation on Laravel's website.ĭownload the nexmo composer package: composer require nexmo/clientĪdd the config nexmo config to config/services.php file: 'nexmo' => [ $mobileNumber = implode(" ", $postData) Ĭurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0) Ĭurl_setopt($ch, CURLOPT_SSL_VERIFYpeer, 0) public function sendMsg(Request $request) I tried to see the method implode () but no success. I tried to do a dd (' $ message ') and dd (' $ options') I get the values of my fields well but when sending I always have the same error. When sending I have this error in my browser "Array to string conversion" and the error shows this line " CURLOPT_POSTFIELDS => $postData "if someone can help me." Hi everyone I have a problem with my code I try to send a nexmo text to all the numbers in my database. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |