private function getCommentsData($id) { $ticket = new Ticket(); $attachmentsArr = []; $attachments = $ticket->getCommentsAttachment($id); foreach ($attachments as $attachment) { $attachmentsArr[$attachment->comment_id][] = $attachment; } return ['comments' => $ticket->getTicketComments($id), 'attachments' => $attachmentsArr]; }
public function getTicketComments($id) { $ticket = new Ticket(); $result = $ticket->getTicketComments($id); return response(['data' => $result], 200); }