Contacts

An inbox for the messages a public contact form writes to contact_submissions. Read and unread state, archive, bulk actions and reply drafts, with a hook for your own Mailable.

The contact inbox with unread, read, replied and archived messages
/admin/contacts.

What it adds

FilePurpose
app/Models/ContactSubmission.phpName, email, subject, message, status, IP, reply and reply timestamp
database/factories/ContactSubmissionFactory.phpFactory with a replied state
database/migrations/*_create_contact_submissions_table.php
app/Livewire/Admin/Contacts/ContactList.php and its viewThe inbox

Install

php artisan ui-kit:install-module contacts

No Composer packages.

What the installer changes

  • Adds one route between the markers in routes/admin.php.
  • Adds a Contacts entry with the unread_contacts badge in config/admin.php.
  • Runs the migration.

Routes

RouteName
GET /admin/contactsadmin.contacts.index

Left to you

  • The public form. Validate and write a ContactSubmission from your own controller or Livewire component; the module stores and displays, nothing more.
  • Replies by email. ContactList@submitReply saves the draft and has a commented Mail::to() call waiting for your ContactReply Mailable.
  • The badge. Return ['unread_contacts' => ContactSubmission::where('status', 'unread')->count()] from your SidebarBadgeResolver.

With support tickets

When the support-tickets module is also installed, each message gets a Copy to Ticket button that opens a ticket for the sender with the message as the first reply.

Removing

Delete the model, factory, Livewire component and view, remove the route line and the nav entry between their markers, drop contact_submissions, and remove contacts from installed_modules.

Was this page helpful?