protected function oooPushIt(Message $message, $html = '')
    {
        $thread = $message->thread;
        $sender = $message->user;

        $data = [
            'thread_id' => $thread->id,
            'div_id' => 'thread_' . $thread->id,
            'sender_name' => $sender->name,
            'thread_url' => route('messages.show', ['id' => $thread->id]),
            'thread_subject' => $thread->subject,
            'message' => $message->body,
            'html' => $html,
            'text' => str_limit($message->body, 50),
        ];

        $recipients = $thread->participantsUserIds();
        if (count($recipients) > 0) {
            foreach ($recipients as $recipient) {
                if ($recipient == $sender->id) {
                    continue;
                }

                $pusher_resp = Pusher::trigger(['for_user_' . $recipient], 'new_message', $data);
                // We're done here - how easy was that, it just works!
            }
        }

        return $pusher_resp;
    }
protected function oooPushIt(Message $message, $html = '')
    {
        $thread = $message->thread;
        $sender = $message->user;

        $data = [
            'thread_id' => $thread->id,
            'div_id' => 'thread_' . $thread->id,
            'sender_name' => $sender->name,
            'thread_url' => route('messages.show', ['id' => $thread->id]),
            'thread_subject' => $thread->subject,
            'message' => $message->body,
            'html' => $html,
            'text' => str_limit($message->body, 50),
        ];

        $recipients = $thread->participantsUserIds();
        if (count($recipients) > 0) {
            foreach ($recipients as $recipient) {
                if ($recipient == $sender->id) {
                    continue;
                }

                $pusher_resp = Pusher::trigger(['for_user_' . $recipient], 'new_message', $data);
                // We're done here - how easy was that, it just works!
            }
        }

        return $pusher_resp;
    }
protected function oooPushIt ( Message $ message , $ html = '' ) { $ thread = $ message -> thread ; $ sender = $ message -> user ; $ data = [ 'thread_id' => $ thread -> id , 'div_id' => 'thread_' . $ thread -> id , 'sender_name' => $ sender -> name , 'thread_url' => route ( 'messages.show' , [ 'id' => $ thread -> id ] ) , 'thread_subject' => $ thread -> subject , 'message' => $ message -> body , 'html' => $ html , 'text' => str_limit ( $ message -> body , 50 ) , ] ; $ recipients = $ thread -> participantsUserIds ( ) ; if ( count ( $ recipients ) > 0 ) { foreach ( $ recipients as $ recipient ) { if ( $ recipient == $ sender -> id ) { continue ; } $ pusher_resp = Pusher :: trigger ( [ 'for_user_' . $ recipient ] , 'new_message' , $ data ) ; // We're done here - how easy was that, it just works! } } return $ pusher_resp ; }
Send the new message to Pusher in order to notify users.

@param Message $message
Send the new message to Pusher in order to notify users .