예제 #1
0
 /**
  * View all messages in a conversation.
  * Start with the last n messages based on $per_page
  * @param  int $conversation_id Conversation ID to view
  * @param  int $display_items        How many last n messages to show at first
  * @return array
  */
 public static function viewConversation($conversation_id, $display_items)
 {
     // Init
     $prefix = DB::getTablePrefix();
     try {
         $count = Conversation::messageCount($conversation_id, $display_items);
         $offset = $count ? $count - $display_items : 0;
         $offset = $offset >= 0 ? $offset : 0;
         $results = DB::select("\n\t\t\t\tSELECT * FROM {$prefix}messages\n\t\t\t\t\tWHERE conversation_id = ?\n\t\t\t\t\tORDER BY created_at LIMIT ?,?", [$conversation_id, $offset, $display_items]);
         return $results;
     } catch (Exception $e) {
         throw new Exception();
     }
 }
예제 #2
0
 public static function getParticipants($conversation_id)
 {
     try {
         return Conversation::getParticipants($conversation_id);
     } catch (Exception $e) {
         throw new Exception();
     }
 }