Support tickets

An admin-side ticket queue with replies, filters and a badge. The public side, the form or email that creates a ticket, is yours to build.

The support ticket queue with search, filters and a list of tickets
/admin/support.

What it adds

FilePurpose
app/Models/SupportTicket.php, app/Models/TicketReply.phpModels with a ulid per ticket, open() scope, replies relation
database/factories/SupportTicketFactory.php, TicketReplyFactory.phpFactories, with closed() and fromAdmin() states
database/migrations/*_create_support_tickets_table.php, *_create_ticket_replies_table.phpsupport_tickets with subject, category, priority, status, IP and closed timestamp; ticket_replies with an is_admin_reply flag
app/Livewire/Admin/Support/TicketList.php, TicketDetail.php and their viewsThe queue and the thread

Install

php artisan ui-kit:install-module support-tickets

No Composer packages.

What the installer changes

  • Adds two routes between the markers in routes/admin.php.
  • Adds a Support entry with the open_tickets badge between the nav markers in config/admin.php.
  • Runs the two migrations.

Routes

RouteNameComponent
GET /admin/supportadmin.support.indexTicketList: search by name or email, filter by status, priority and category
GET /admin/support/{ulid}admin.support.showTicketDetail: the thread, inline reply, status and priority changes validated server-side
A single ticket with its replies and the reply form
A ticket thread. Admin replies are flagged so your own notification can tell them apart.

Left to you

  • Creating tickets. Write to SupportTicket from your contact form, your API, or an inbound mail handler. The contacts module adds a Copy to Ticket button when both are installed.
  • Notifications. The module ships no Mailables, so replies do not email anyone until you add a notification where TicketDetail saves a reply.
  • The badge. Bind a SidebarBadgeResolver that returns ['open_tickets' => SupportTicket::open()->count()]; see Customising.

Removing

Delete the models, factories, Livewire components and views, remove the two route lines and the nav entry between their markers, drop the two tables, and remove support-tickets from installed_modules in config/ui-kit.php.

Was this page helpful?