datatableService = $datatableService; $this->ticketTemplateRepo = $ticketTemplateRepository; } /** * @return TicketTemplateRepository */ protected function getRepo() { return $this->ticketTemplateRepo; } /** * @return \Illuminate\Http\JsonResponse */ public function getDatatable() { $datatable = new TicketTemplateDatatable(false); $query = $this->ticketTemplateRepo->find(); return $this->datatableService->createDatatable($datatable, $query); } public function processVariables($template, array $data) { } public static function getVariables(Ticket $ticket) { if ($ticket->agent) { $agent = $ticket->agent->getName(); $signature = $ticket->agent->signature; } else { $agent = trans('texts.unassigned'); $signature = ''; } if($ticket->client) { $client = $ticket->client->getDisplayName(); $contact = $ticket->getContactName(); } else { $client = 'No client'; $contact = 'No Contact'; } return [ '$ticketNumber' => $ticket->ticket_number, '$ticketStatus' => Ticket::getStatusNameById($ticket->status_id), '$client' => $client, '$contact' => $contact, '$priority' => $ticket->getPriorityName(), '$dueDate' => $ticket->getDueDate(), '$agent' => $agent, '$status' => Ticket::getStatusNameById($ticket->status_id), '$subject' => $ticket->subject, '$description' => $ticket->getLastComment()->description ?? '', '$signature' => $signature, ]; } }