Example #1
0
 /**
  * {@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;
 }
Example #3
0
 /**
  * {@inheritDoc}
  * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send()
  */
 public function send(NotificationMessage $message)
 {
     try {
         $content = (string) $message->getContent();
         if (!empty($content)) {
             $viewSettings = $message->getViewSettings();
             $type = @$viewSettings['type'];
             if (!in_array($type, ['info', 'success', 'error'])) {
                 $type = 'info';
             }
             Flash::add($type, $content);
         }
     } catch (\Exception $e) {
         Log::error(sprintf('Sending a Flash notification failed:  %s', $e));
     }
 }
Example #4
0
 /**
  * {@inheritDoc}
  * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send()
  */
 public function send(NotificationMessage $message)
 {
     $notification = new Notification();
     $notification->user = $message->getTo();
     $notification->subject = $message->getSubject();
     $notification->message = (string) $message->getContent();
     if (!empty($notification->message)) {
         // Attach object to notification if it exists in the message
         if (!is_null($attachObject = $message->getAttachObject())) {
             if (is_object($attachObject)) {
                 $notification->object_id = $attachObject->id;
                 $notification->object_type = get_class($attachObject);
             }
         }
         return $notification->save();
     }
 }
Example #5
0
 /**
  * {@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);
         }
     }
 }
Example #6
0
 /**
  * {@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);
 }