/** * {@inheritDoc} * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send() */ public function send(NotificationMessage $notification) { $data = $notification->getData(); $view = $notification->getView(); if (\Mail::send($view, $data, function ($message) use($notification) { $user = $notification->getTo(); $message->to($user->email, $user->name); }) == 0) { //throw new \Exception('Email notification was not send.'); } }
/** * Use NotificationMessage setData method to add user twitterHandle * {@inheritDoc} * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send() */ public function send(NotificationMessage $message) { // TODO : add validation to control the size of the message. $data = $message->getData(); $txt = $message->getContent(); $screen_name = $message->getTo(); $url = 'https://api.twitter.com/1.1/direct_messages/new.json'; $postfields = ['screen_name' => $screen_name, 'text' => $txt]; $requestMethod = 'POST'; $client = $this->getClient(); $response = $client->setPostfields($postfields)->buildOauth($url, $requestMethod)->performRequest(); echo $response; }
/** * {@inheritDoc} * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send() */ public function send(NotificationMessage $message) { // TODO : add validation to control the size of the message. $toUser = $message->getTo(); $data = $message->getData(); $txt = strip_tags($message->getContent()); $txt = $this->chunkLongText($txt, 130); foreach ($txt as $t) { // Clean phone user $toPhone = $this->cleanPhone($toUser->phone); if (!empty($toPhone)) { $sms = $this->client->account->sms_messages->create($this->fromNumber, $toPhone, $t); } } }
/** * {@inheritDoc} * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send() */ public function send(NotificationMessage $message) { $data = $message->getData(); // Send notification to log Log::info('Send a dummny notification', $data); }