new helpdesk module

This commit is contained in:
Mark Gregory
2026-06-12 10:10:52 +01:00
parent 28a34cfa87
commit 67faed6165
26 changed files with 630 additions and 11 deletions
+4 -1
View File
@@ -35,12 +35,14 @@ final class TicketService
/** @var Ticket $ticket */
$ticket = Ticket::query()->create([
'reference' => $this->references->next(),
'company_id' => $data['company_id'] ?? ($user->company_id ?? null),
'user_id' => $user->id,
'agent_id' => $this->assignment->selectAgentId($data['category_id'] ?? null),
'status_id' => $status->id,
'priority_id' => $data['priority_id'],
'category_id' => $data['category_id'] ?? null,
'project_id' => $data['project_id'] ?? null,
'team_id' => $data['team_id'] ?? null,
'subject' => $data['subject'],
'body' => $data['body'],
'due_at' => $data['due_at'] ?? null,
@@ -49,7 +51,7 @@ final class TicketService
$this->attachments->storeMany($ticket, $files, (int) $user->id);
return $ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'attachments']) ?? $ticket;
return $ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team', 'attachments']) ?? $ticket;
});
}
@@ -68,6 +70,7 @@ final class TicketService
return DB::transaction(function () use ($ticket, $user, $body, $internal, $files): Comment {
/** @var Comment $comment */
$comment = $ticket->comments()->create([
'company_id' => $data['company_id'] ?? ($user->company_id ?? null),
'user_id' => $user->id,
'body' => $body,
'is_internal' => $internal,