status != 'closed') { $ticket->status = 'closed'; $ticket->resolved_at = current_time('mysql'); $ticket->closed_by = $person->id; $ticket->total_close_time = current_time('timestamp') - strtotime($ticket->created_at); $ticket->save(); do_action('fluent_support/ticket_closed', $ticket, $person); do_action('fluent_support/ticket_closed_by_' . $person->person_type, $ticket, $person); if(!$internalNote) { $internalNote = __('Ticket has been closed', 'fluent-support'); } Conversation::create([ 'ticket_id' => $ticket->id, 'person_id' => $person->id, 'conversation_type' => 'internal_info', 'content' => $internalNote ]); } return $ticket; } public function reopen($ticket, $person) { if ($ticket->status == 'closed') { $ticket->status = 'active'; $ticket->waiting_since = current_time('mysql'); $ticket->save(); do_action('fluent_support/ticket_reopen', $ticket, $person); do_action('fluent_support/ticket_reopen_by_' . $person->person_type, $ticket, $person); Conversation::create([ 'ticket_id' => $ticket->id, 'person_id' => $person->id, 'conversation_type' => 'internal_info', 'content' => __('Ticket has been reopened', 'fluent-support') ]); } return $person; } public function onAgentChange($ticket, $person){ Conversation::create([ 'ticket_id' => $ticket->id, 'person_id' => $person->id, 'conversation_type' => 'internal_info', 'content' => $ticket->agent->full_name !== $person->full_name ? __($person->full_name .' assign '. $ticket->agent->full_name .' in this ticket' , 'fluent-support') : __($person->full_name. ' assign this ticket to self', 'fluent-support') ]); return $person; } }